|  |  | 1 |  | // <auto-generated> | 
|  |  | 2 |  | // Code generated by Microsoft (R) AutoRest Code Generator. | 
|  |  | 3 |  | // Changes may cause incorrect behavior and will be lost if the code is | 
|  |  | 4 |  | // regenerated. | 
|  |  | 5 |  | // </auto-generated> | 
|  |  | 6 |  |  | 
|  |  | 7 |  | namespace Microsoft.Azure.CognitiveServices.ContentModerator | 
|  |  | 8 |  | { | 
|  |  | 9 |  |     using Microsoft.Rest; | 
|  |  | 10 |  |     using Models; | 
|  |  | 11 |  |     using Newtonsoft.Json; | 
|  |  | 12 |  |     using System.Collections; | 
|  |  | 13 |  |     using System.Collections.Generic; | 
|  |  | 14 |  |     using System.IO; | 
|  |  | 15 |  |     using System.Linq; | 
|  |  | 16 |  |     using System.Net; | 
|  |  | 17 |  |     using System.Net.Http; | 
|  |  | 18 |  |     using System.Net.Http.Headers; | 
|  |  | 19 |  |     using System.Threading; | 
|  |  | 20 |  |     using System.Threading.Tasks; | 
|  |  | 21 |  |  | 
|  |  | 22 |  |     /// <summary> | 
|  |  | 23 |  |     /// Reviews operations. | 
|  |  | 24 |  |     /// </summary> | 
|  |  | 25 |  |     public partial class Reviews : IServiceOperations<ContentModeratorClient>, IReviews | 
|  |  | 26 |  |     { | 
|  |  | 27 |  |         /// <summary> | 
|  |  | 28 |  |         /// Initializes a new instance of the Reviews class. | 
|  |  | 29 |  |         /// </summary> | 
|  |  | 30 |  |         /// <param name='client'> | 
|  |  | 31 |  |         /// Reference to the service client. | 
|  |  | 32 |  |         /// </param> | 
|  |  | 33 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 34 |  |         /// Thrown when a required parameter is null | 
|  |  | 35 |  |         /// </exception> | 
|  | 5 | 36 |  |         public Reviews(ContentModeratorClient client) | 
|  |  | 37 |  |         { | 
|  | 5 | 38 |  |             if (client == null) | 
|  |  | 39 |  |             { | 
|  | 0 | 40 |  |                 throw new System.ArgumentNullException("client"); | 
|  |  | 41 |  |             } | 
|  | 5 | 42 |  |             Client = client; | 
|  | 5 | 43 |  |         } | 
|  |  | 44 |  |  | 
|  |  | 45 |  |         /// <summary> | 
|  |  | 46 |  |         /// Gets a reference to the ContentModeratorClient | 
|  |  | 47 |  |         /// </summary> | 
|  | 44 | 48 |  |         public ContentModeratorClient Client { get; private set; } | 
|  |  | 49 |  |  | 
|  |  | 50 |  |         /// <summary> | 
|  |  | 51 |  |         /// Returns review details for the review Id passed. | 
|  |  | 52 |  |         /// </summary> | 
|  |  | 53 |  |         /// <param name='teamName'> | 
|  |  | 54 |  |         /// Your Team Name. | 
|  |  | 55 |  |         /// </param> | 
|  |  | 56 |  |         /// <param name='reviewId'> | 
|  |  | 57 |  |         /// Id of the review. | 
|  |  | 58 |  |         /// </param> | 
|  |  | 59 |  |         /// <param name='customHeaders'> | 
|  |  | 60 |  |         /// Headers that will be added to request. | 
|  |  | 61 |  |         /// </param> | 
|  |  | 62 |  |         /// <param name='cancellationToken'> | 
|  |  | 63 |  |         /// The cancellation token. | 
|  |  | 64 |  |         /// </param> | 
|  |  | 65 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 66 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 67 |  |         /// </exception> | 
|  |  | 68 |  |         /// <exception cref="SerializationException"> | 
|  |  | 69 |  |         /// Thrown when unable to deserialize the response | 
|  |  | 70 |  |         /// </exception> | 
|  |  | 71 |  |         /// <exception cref="ValidationException"> | 
|  |  | 72 |  |         /// Thrown when a required parameter is null | 
|  |  | 73 |  |         /// </exception> | 
|  |  | 74 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 75 |  |         /// Thrown when a required parameter is null | 
|  |  | 76 |  |         /// </exception> | 
|  |  | 77 |  |         /// <return> | 
|  |  | 78 |  |         /// A response object containing the response body and response headers. | 
|  |  | 79 |  |         /// </return> | 
|  |  | 80 |  |         public async Task<HttpOperationResponse<Review>> GetReviewWithHttpMessagesAsync(string teamName, string reviewId | 
|  |  | 81 |  |         { | 
|  | 2 | 82 |  |             if (Client.Endpoint == null) | 
|  |  | 83 |  |             { | 
|  | 0 | 84 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 85 |  |             } | 
|  | 2 | 86 |  |             if (teamName == null) | 
|  |  | 87 |  |             { | 
|  | 0 | 88 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 89 |  |             } | 
|  | 2 | 90 |  |             if (reviewId == null) | 
|  |  | 91 |  |             { | 
|  | 0 | 92 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "reviewId"); | 
|  |  | 93 |  |             } | 
|  |  | 94 |  |             // Tracing | 
|  | 2 | 95 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  | 2 | 96 |  |             string _invocationId = null; | 
|  | 2 | 97 |  |             if (_shouldTrace) | 
|  |  | 98 |  |             { | 
|  | 0 | 99 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  | 0 | 100 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  | 0 | 101 |  |                 tracingParameters.Add("teamName", teamName); | 
|  | 0 | 102 |  |                 tracingParameters.Add("reviewId", reviewId); | 
|  | 0 | 103 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  | 0 | 104 |  |                 ServiceClientTracing.Enter(_invocationId, this, "GetReview", tracingParameters); | 
|  |  | 105 |  |             } | 
|  |  | 106 |  |             // Construct URL | 
|  | 2 | 107 |  |             var _baseUrl = Client.BaseUri; | 
|  | 2 | 108 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r | 
|  | 2 | 109 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  | 2 | 110 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  | 2 | 111 |  |             _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId)); | 
|  |  | 112 |  |             // Create HTTP transport objects | 
|  | 2 | 113 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  | 2 | 114 |  |             HttpResponseMessage _httpResponse = null; | 
|  | 2 | 115 |  |             _httpRequest.Method = new HttpMethod("GET"); | 
|  | 2 | 116 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 117 |  |             // Set Headers | 
|  |  | 118 |  |  | 
|  |  | 119 |  |  | 
|  | 2 | 120 |  |             if (customHeaders != null) | 
|  |  | 121 |  |             { | 
|  | 0 | 122 |  |                 foreach(var _header in customHeaders) | 
|  |  | 123 |  |                 { | 
|  | 0 | 124 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 125 |  |                     { | 
|  | 0 | 126 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 127 |  |                     } | 
|  | 0 | 128 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 129 |  |                 } | 
|  |  | 130 |  |             } | 
|  |  | 131 |  |  | 
|  |  | 132 |  |             // Serialize Request | 
|  | 2 | 133 |  |             string _requestContent = null; | 
|  |  | 134 |  |             // Set Credentials | 
|  | 2 | 135 |  |             if (Client.Credentials != null) | 
|  |  | 136 |  |             { | 
|  | 2 | 137 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  | 2 | 138 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 139 |  |             } | 
|  |  | 140 |  |             // Send Request | 
|  | 2 | 141 |  |             if (_shouldTrace) | 
|  |  | 142 |  |             { | 
|  | 0 | 143 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 144 |  |             } | 
|  | 2 | 145 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 2 | 146 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  | 2 | 147 |  |             if (_shouldTrace) | 
|  |  | 148 |  |             { | 
|  | 0 | 149 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 150 |  |             } | 
|  | 2 | 151 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  | 2 | 152 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 2 | 153 |  |             string _responseContent = null; | 
|  | 2 | 154 |  |             if ((int)_statusCode != 200) | 
|  |  | 155 |  |             { | 
|  | 0 | 156 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 157 |  |                 try | 
|  |  | 158 |  |                 { | 
|  | 0 | 159 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  | 0 | 160 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  | 0 | 161 |  |                     if (_errorBody != null) | 
|  |  | 162 |  |                     { | 
|  | 0 | 163 |  |                         ex.Body = _errorBody; | 
|  |  | 164 |  |                     } | 
|  | 0 | 165 |  |                 } | 
|  | 0 | 166 |  |                 catch (JsonException) | 
|  |  | 167 |  |                 { | 
|  |  | 168 |  |                     // Ignore the exception | 
|  | 0 | 169 |  |                 } | 
|  | 0 | 170 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  | 0 | 171 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  | 0 | 172 |  |                 if (_shouldTrace) | 
|  |  | 173 |  |                 { | 
|  | 0 | 174 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 175 |  |                 } | 
|  | 0 | 176 |  |                 _httpRequest.Dispose(); | 
|  | 0 | 177 |  |                 if (_httpResponse != null) | 
|  |  | 178 |  |                 { | 
|  | 0 | 179 |  |                     _httpResponse.Dispose(); | 
|  |  | 180 |  |                 } | 
|  | 0 | 181 |  |                 throw ex; | 
|  |  | 182 |  |             } | 
|  |  | 183 |  |             // Create Result | 
|  | 2 | 184 |  |             var _result = new HttpOperationResponse<Review>(); | 
|  | 2 | 185 |  |             _result.Request = _httpRequest; | 
|  | 2 | 186 |  |             _result.Response = _httpResponse; | 
|  |  | 187 |  |             // Deserialize Response | 
|  | 2 | 188 |  |             if ((int)_statusCode == 200) | 
|  |  | 189 |  |             { | 
|  | 2 | 190 |  |                 _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  |  | 191 |  |                 try | 
|  |  | 192 |  |                 { | 
|  | 2 | 193 |  |                     _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Review>(_responseContent, Client | 
|  | 2 | 194 |  |                 } | 
|  | 0 | 195 |  |                 catch (JsonException ex) | 
|  |  | 196 |  |                 { | 
|  | 0 | 197 |  |                     _httpRequest.Dispose(); | 
|  | 0 | 198 |  |                     if (_httpResponse != null) | 
|  |  | 199 |  |                     { | 
|  | 0 | 200 |  |                         _httpResponse.Dispose(); | 
|  |  | 201 |  |                     } | 
|  | 0 | 202 |  |                     throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); | 
|  |  | 203 |  |                 } | 
|  |  | 204 |  |             } | 
|  | 2 | 205 |  |             if (_shouldTrace) | 
|  |  | 206 |  |             { | 
|  | 0 | 207 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 208 |  |             } | 
|  | 2 | 209 |  |             return _result; | 
|  | 2 | 210 |  |         } | 
|  |  | 211 |  |  | 
|  |  | 212 |  |         /// <summary> | 
|  |  | 213 |  |         /// Get the Job Details for a Job Id. | 
|  |  | 214 |  |         /// </summary> | 
|  |  | 215 |  |         /// <param name='teamName'> | 
|  |  | 216 |  |         /// Your Team Name. | 
|  |  | 217 |  |         /// </param> | 
|  |  | 218 |  |         /// <param name='jobId'> | 
|  |  | 219 |  |         /// Id of the job. | 
|  |  | 220 |  |         /// </param> | 
|  |  | 221 |  |         /// <param name='customHeaders'> | 
|  |  | 222 |  |         /// Headers that will be added to request. | 
|  |  | 223 |  |         /// </param> | 
|  |  | 224 |  |         /// <param name='cancellationToken'> | 
|  |  | 225 |  |         /// The cancellation token. | 
|  |  | 226 |  |         /// </param> | 
|  |  | 227 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 228 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 229 |  |         /// </exception> | 
|  |  | 230 |  |         /// <exception cref="SerializationException"> | 
|  |  | 231 |  |         /// Thrown when unable to deserialize the response | 
|  |  | 232 |  |         /// </exception> | 
|  |  | 233 |  |         /// <exception cref="ValidationException"> | 
|  |  | 234 |  |         /// Thrown when a required parameter is null | 
|  |  | 235 |  |         /// </exception> | 
|  |  | 236 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 237 |  |         /// Thrown when a required parameter is null | 
|  |  | 238 |  |         /// </exception> | 
|  |  | 239 |  |         /// <return> | 
|  |  | 240 |  |         /// A response object containing the response body and response headers. | 
|  |  | 241 |  |         /// </return> | 
|  |  | 242 |  |         public async Task<HttpOperationResponse<Job>> GetJobDetailsWithHttpMessagesAsync(string teamName, string jobId,  | 
|  |  | 243 |  |         { | 
|  | 0 | 244 |  |             if (Client.Endpoint == null) | 
|  |  | 245 |  |             { | 
|  | 0 | 246 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 247 |  |             } | 
|  | 0 | 248 |  |             if (teamName == null) | 
|  |  | 249 |  |             { | 
|  | 0 | 250 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 251 |  |             } | 
|  | 0 | 252 |  |             if (jobId == null) | 
|  |  | 253 |  |             { | 
|  | 0 | 254 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "jobId"); | 
|  |  | 255 |  |             } | 
|  |  | 256 |  |             // Tracing | 
|  | 0 | 257 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  | 0 | 258 |  |             string _invocationId = null; | 
|  | 0 | 259 |  |             if (_shouldTrace) | 
|  |  | 260 |  |             { | 
|  | 0 | 261 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  | 0 | 262 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  | 0 | 263 |  |                 tracingParameters.Add("teamName", teamName); | 
|  | 0 | 264 |  |                 tracingParameters.Add("jobId", jobId); | 
|  | 0 | 265 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  | 0 | 266 |  |                 ServiceClientTracing.Enter(_invocationId, this, "GetJobDetails", tracingParameters); | 
|  |  | 267 |  |             } | 
|  |  | 268 |  |             // Construct URL | 
|  | 0 | 269 |  |             var _baseUrl = Client.BaseUri; | 
|  | 0 | 270 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/j | 
|  | 0 | 271 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  | 0 | 272 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  | 0 | 273 |  |             _url = _url.Replace("{JobId}", System.Uri.EscapeDataString(jobId)); | 
|  |  | 274 |  |             // Create HTTP transport objects | 
|  | 0 | 275 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  | 0 | 276 |  |             HttpResponseMessage _httpResponse = null; | 
|  | 0 | 277 |  |             _httpRequest.Method = new HttpMethod("GET"); | 
|  | 0 | 278 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 279 |  |             // Set Headers | 
|  |  | 280 |  |  | 
|  |  | 281 |  |  | 
|  | 0 | 282 |  |             if (customHeaders != null) | 
|  |  | 283 |  |             { | 
|  | 0 | 284 |  |                 foreach(var _header in customHeaders) | 
|  |  | 285 |  |                 { | 
|  | 0 | 286 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 287 |  |                     { | 
|  | 0 | 288 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 289 |  |                     } | 
|  | 0 | 290 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 291 |  |                 } | 
|  |  | 292 |  |             } | 
|  |  | 293 |  |  | 
|  |  | 294 |  |             // Serialize Request | 
|  | 0 | 295 |  |             string _requestContent = null; | 
|  |  | 296 |  |             // Set Credentials | 
|  | 0 | 297 |  |             if (Client.Credentials != null) | 
|  |  | 298 |  |             { | 
|  | 0 | 299 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 300 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 301 |  |             } | 
|  |  | 302 |  |             // Send Request | 
|  | 0 | 303 |  |             if (_shouldTrace) | 
|  |  | 304 |  |             { | 
|  | 0 | 305 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 306 |  |             } | 
|  | 0 | 307 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 308 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  | 0 | 309 |  |             if (_shouldTrace) | 
|  |  | 310 |  |             { | 
|  | 0 | 311 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 312 |  |             } | 
|  | 0 | 313 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  | 0 | 314 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 315 |  |             string _responseContent = null; | 
|  | 0 | 316 |  |             if ((int)_statusCode != 200) | 
|  |  | 317 |  |             { | 
|  | 0 | 318 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 319 |  |                 try | 
|  |  | 320 |  |                 { | 
|  | 0 | 321 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  | 0 | 322 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  | 0 | 323 |  |                     if (_errorBody != null) | 
|  |  | 324 |  |                     { | 
|  | 0 | 325 |  |                         ex.Body = _errorBody; | 
|  |  | 326 |  |                     } | 
|  | 0 | 327 |  |                 } | 
|  | 0 | 328 |  |                 catch (JsonException) | 
|  |  | 329 |  |                 { | 
|  |  | 330 |  |                     // Ignore the exception | 
|  | 0 | 331 |  |                 } | 
|  | 0 | 332 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  | 0 | 333 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  | 0 | 334 |  |                 if (_shouldTrace) | 
|  |  | 335 |  |                 { | 
|  | 0 | 336 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 337 |  |                 } | 
|  | 0 | 338 |  |                 _httpRequest.Dispose(); | 
|  | 0 | 339 |  |                 if (_httpResponse != null) | 
|  |  | 340 |  |                 { | 
|  | 0 | 341 |  |                     _httpResponse.Dispose(); | 
|  |  | 342 |  |                 } | 
|  | 0 | 343 |  |                 throw ex; | 
|  |  | 344 |  |             } | 
|  |  | 345 |  |             // Create Result | 
|  | 0 | 346 |  |             var _result = new HttpOperationResponse<Job>(); | 
|  | 0 | 347 |  |             _result.Request = _httpRequest; | 
|  | 0 | 348 |  |             _result.Response = _httpResponse; | 
|  |  | 349 |  |             // Deserialize Response | 
|  | 0 | 350 |  |             if ((int)_statusCode == 200) | 
|  |  | 351 |  |             { | 
|  | 0 | 352 |  |                 _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  |  | 353 |  |                 try | 
|  |  | 354 |  |                 { | 
|  | 0 | 355 |  |                     _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Job>(_responseContent, Client.De | 
|  | 0 | 356 |  |                 } | 
|  | 0 | 357 |  |                 catch (JsonException ex) | 
|  |  | 358 |  |                 { | 
|  | 0 | 359 |  |                     _httpRequest.Dispose(); | 
|  | 0 | 360 |  |                     if (_httpResponse != null) | 
|  |  | 361 |  |                     { | 
|  | 0 | 362 |  |                         _httpResponse.Dispose(); | 
|  |  | 363 |  |                     } | 
|  | 0 | 364 |  |                     throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); | 
|  |  | 365 |  |                 } | 
|  |  | 366 |  |             } | 
|  | 0 | 367 |  |             if (_shouldTrace) | 
|  |  | 368 |  |             { | 
|  | 0 | 369 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 370 |  |             } | 
|  | 0 | 371 |  |             return _result; | 
|  | 0 | 372 |  |         } | 
|  |  | 373 |  |  | 
|  |  | 374 |  |         /// <summary> | 
|  |  | 375 |  |         /// The reviews created would show up for Reviewers on your team. As Reviewers | 
|  |  | 376 |  |         /// complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) | 
|  |  | 377 |  |         /// on the specified CallBackEndpoint. | 
|  |  | 378 |  |         /// | 
|  |  | 379 |  |         /// <h3>CallBack Schemas </h3> | 
|  |  | 380 |  |         /// <h4>Review Completion CallBack Sample</h4> | 
|  |  | 381 |  |         /// <p> | 
|  |  | 382 |  |         /// {<br/> | 
|  |  | 383 |  |         /// "ReviewId": "<Review Id>",<br/> | 
|  |  | 384 |  |         /// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/> | 
|  |  | 385 |  |         /// "ModifiedBy": "<Name of the Reviewer>",<br/> | 
|  |  | 386 |  |         /// "CallBackType": "Review",<br/> | 
|  |  | 387 |  |         /// "ContentId": "<The ContentId that was specified input>",<br/> | 
|  |  | 388 |  |         /// "Metadata": {<br/> | 
|  |  | 389 |  |         /// "adultscore": "0.xxx",<br/> | 
|  |  | 390 |  |         /// "a": "False",<br/> | 
|  |  | 391 |  |         /// "racyscore": "0.xxx",<br/> | 
|  |  | 392 |  |         /// "r": "True"<br/> | 
|  |  | 393 |  |         /// },<br/> | 
|  |  | 394 |  |         /// "ReviewerResultTags": {<br/> | 
|  |  | 395 |  |         /// "a": "False",<br/> | 
|  |  | 396 |  |         /// "r": "True"<br/> | 
|  |  | 397 |  |         /// }<br/> | 
|  |  | 398 |  |         /// }<br/> | 
|  |  | 399 |  |         /// | 
|  |  | 400 |  |         /// </p>. | 
|  |  | 401 |  |         /// </summary> | 
|  |  | 402 |  |         /// <param name='urlContentType'> | 
|  |  | 403 |  |         /// The content type. | 
|  |  | 404 |  |         /// </param> | 
|  |  | 405 |  |         /// <param name='teamName'> | 
|  |  | 406 |  |         /// Your team name. | 
|  |  | 407 |  |         /// </param> | 
|  |  | 408 |  |         /// <param name='createReviewBody'> | 
|  |  | 409 |  |         /// Body for create reviews API | 
|  |  | 410 |  |         /// </param> | 
|  |  | 411 |  |         /// <param name='subTeam'> | 
|  |  | 412 |  |         /// SubTeam of your team, you want to assign the created review to. | 
|  |  | 413 |  |         /// </param> | 
|  |  | 414 |  |         /// <param name='customHeaders'> | 
|  |  | 415 |  |         /// Headers that will be added to request. | 
|  |  | 416 |  |         /// </param> | 
|  |  | 417 |  |         /// <param name='cancellationToken'> | 
|  |  | 418 |  |         /// The cancellation token. | 
|  |  | 419 |  |         /// </param> | 
|  |  | 420 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 421 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 422 |  |         /// </exception> | 
|  |  | 423 |  |         /// <exception cref="SerializationException"> | 
|  |  | 424 |  |         /// Thrown when unable to deserialize the response | 
|  |  | 425 |  |         /// </exception> | 
|  |  | 426 |  |         /// <exception cref="ValidationException"> | 
|  |  | 427 |  |         /// Thrown when a required parameter is null | 
|  |  | 428 |  |         /// </exception> | 
|  |  | 429 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 430 |  |         /// Thrown when a required parameter is null | 
|  |  | 431 |  |         /// </exception> | 
|  |  | 432 |  |         /// <return> | 
|  |  | 433 |  |         /// A response object containing the response body and response headers. | 
|  |  | 434 |  |         /// </return> | 
|  |  | 435 |  |         public async Task<HttpOperationResponse<IList<string>>> CreateReviewsWithHttpMessagesAsync(string urlContentType | 
|  |  | 436 |  |         { | 
|  | 1 | 437 |  |             if (Client.Endpoint == null) | 
|  |  | 438 |  |             { | 
|  | 0 | 439 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 440 |  |             } | 
|  | 1 | 441 |  |             if (urlContentType == null) | 
|  |  | 442 |  |             { | 
|  | 0 | 443 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "urlContentType"); | 
|  |  | 444 |  |             } | 
|  | 1 | 445 |  |             if (teamName == null) | 
|  |  | 446 |  |             { | 
|  | 0 | 447 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 448 |  |             } | 
|  | 1 | 449 |  |             if (createReviewBody == null) | 
|  |  | 450 |  |             { | 
|  | 0 | 451 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "createReviewBody"); | 
|  |  | 452 |  |             } | 
|  | 1 | 453 |  |             if (createReviewBody != null) | 
|  |  | 454 |  |             { | 
|  | 4 | 455 |  |                 foreach (var element in createReviewBody) | 
|  |  | 456 |  |                 { | 
|  | 1 | 457 |  |                     if (element != null) | 
|  |  | 458 |  |                     { | 
|  | 1 | 459 |  |                         element.Validate(); | 
|  |  | 460 |  |                     } | 
|  |  | 461 |  |                 } | 
|  |  | 462 |  |             } | 
|  |  | 463 |  |             // Tracing | 
|  | 1 | 464 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  | 1 | 465 |  |             string _invocationId = null; | 
|  | 1 | 466 |  |             if (_shouldTrace) | 
|  |  | 467 |  |             { | 
|  | 0 | 468 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  | 0 | 469 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  | 0 | 470 |  |                 tracingParameters.Add("urlContentType", urlContentType); | 
|  | 0 | 471 |  |                 tracingParameters.Add("teamName", teamName); | 
|  | 0 | 472 |  |                 tracingParameters.Add("subTeam", subTeam); | 
|  | 0 | 473 |  |                 tracingParameters.Add("createReviewBody", createReviewBody); | 
|  | 0 | 474 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  | 0 | 475 |  |                 ServiceClientTracing.Enter(_invocationId, this, "CreateReviews", tracingParameters); | 
|  |  | 476 |  |             } | 
|  |  | 477 |  |             // Construct URL | 
|  | 1 | 478 |  |             var _baseUrl = Client.BaseUri; | 
|  | 1 | 479 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r | 
|  | 1 | 480 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  | 1 | 481 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  | 1 | 482 |  |             List<string> _queryParameters = new List<string>(); | 
|  | 1 | 483 |  |             if (subTeam != null) | 
|  |  | 484 |  |             { | 
|  | 0 | 485 |  |                 _queryParameters.Add(string.Format("subTeam={0}", System.Uri.EscapeDataString(subTeam))); | 
|  |  | 486 |  |             } | 
|  | 1 | 487 |  |             if (_queryParameters.Count > 0) | 
|  |  | 488 |  |             { | 
|  | 0 | 489 |  |                 _url += "?" + string.Join("&", _queryParameters); | 
|  |  | 490 |  |             } | 
|  |  | 491 |  |             // Create HTTP transport objects | 
|  | 1 | 492 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  | 1 | 493 |  |             HttpResponseMessage _httpResponse = null; | 
|  | 1 | 494 |  |             _httpRequest.Method = new HttpMethod("POST"); | 
|  | 1 | 495 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 496 |  |             // Set Headers | 
|  | 1 | 497 |  |             if (urlContentType != null) | 
|  |  | 498 |  |             { | 
|  | 1 | 499 |  |                 if (_httpRequest.Headers.Contains("UrlContentType")) | 
|  |  | 500 |  |                 { | 
|  | 0 | 501 |  |                     _httpRequest.Headers.Remove("UrlContentType"); | 
|  |  | 502 |  |                 } | 
|  | 1 | 503 |  |                 _httpRequest.Headers.TryAddWithoutValidation("UrlContentType", urlContentType); | 
|  |  | 504 |  |             } | 
|  |  | 505 |  |  | 
|  |  | 506 |  |  | 
|  | 1 | 507 |  |             if (customHeaders != null) | 
|  |  | 508 |  |             { | 
|  | 0 | 509 |  |                 foreach(var _header in customHeaders) | 
|  |  | 510 |  |                 { | 
|  | 0 | 511 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 512 |  |                     { | 
|  | 0 | 513 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 514 |  |                     } | 
|  | 0 | 515 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 516 |  |                 } | 
|  |  | 517 |  |             } | 
|  |  | 518 |  |  | 
|  |  | 519 |  |             // Serialize Request | 
|  | 1 | 520 |  |             string _requestContent = null; | 
|  | 1 | 521 |  |             if(createReviewBody != null) | 
|  |  | 522 |  |             { | 
|  | 1 | 523 |  |                 _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createReviewBody, Client.Serializat | 
|  | 1 | 524 |  |                 _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); | 
|  | 1 | 525 |  |                 _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); | 
|  |  | 526 |  |             } | 
|  |  | 527 |  |             // Set Credentials | 
|  | 1 | 528 |  |             if (Client.Credentials != null) | 
|  |  | 529 |  |             { | 
|  | 1 | 530 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  | 1 | 531 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 532 |  |             } | 
|  |  | 533 |  |             // Send Request | 
|  | 1 | 534 |  |             if (_shouldTrace) | 
|  |  | 535 |  |             { | 
|  | 0 | 536 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 537 |  |             } | 
|  | 1 | 538 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 1 | 539 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  | 1 | 540 |  |             if (_shouldTrace) | 
|  |  | 541 |  |             { | 
|  | 0 | 542 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 543 |  |             } | 
|  | 1 | 544 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  | 1 | 545 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 1 | 546 |  |             string _responseContent = null; | 
|  | 1 | 547 |  |             if ((int)_statusCode != 200) | 
|  |  | 548 |  |             { | 
|  | 0 | 549 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 550 |  |                 try | 
|  |  | 551 |  |                 { | 
|  | 0 | 552 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  | 0 | 553 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  | 0 | 554 |  |                     if (_errorBody != null) | 
|  |  | 555 |  |                     { | 
|  | 0 | 556 |  |                         ex.Body = _errorBody; | 
|  |  | 557 |  |                     } | 
|  | 0 | 558 |  |                 } | 
|  | 0 | 559 |  |                 catch (JsonException) | 
|  |  | 560 |  |                 { | 
|  |  | 561 |  |                     // Ignore the exception | 
|  | 0 | 562 |  |                 } | 
|  | 0 | 563 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  | 0 | 564 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  | 0 | 565 |  |                 if (_shouldTrace) | 
|  |  | 566 |  |                 { | 
|  | 0 | 567 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 568 |  |                 } | 
|  | 0 | 569 |  |                 _httpRequest.Dispose(); | 
|  | 0 | 570 |  |                 if (_httpResponse != null) | 
|  |  | 571 |  |                 { | 
|  | 0 | 572 |  |                     _httpResponse.Dispose(); | 
|  |  | 573 |  |                 } | 
|  | 0 | 574 |  |                 throw ex; | 
|  |  | 575 |  |             } | 
|  |  | 576 |  |             // Create Result | 
|  | 1 | 577 |  |             var _result = new HttpOperationResponse<IList<string>>(); | 
|  | 1 | 578 |  |             _result.Request = _httpRequest; | 
|  | 1 | 579 |  |             _result.Response = _httpResponse; | 
|  |  | 580 |  |             // Deserialize Response | 
|  | 1 | 581 |  |             if ((int)_statusCode == 200) | 
|  |  | 582 |  |             { | 
|  | 1 | 583 |  |                 _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  |  | 584 |  |                 try | 
|  |  | 585 |  |                 { | 
|  | 1 | 586 |  |                     _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<IList<string>>(_responseContent, | 
|  | 1 | 587 |  |                 } | 
|  | 0 | 588 |  |                 catch (JsonException ex) | 
|  |  | 589 |  |                 { | 
|  | 0 | 590 |  |                     _httpRequest.Dispose(); | 
|  | 0 | 591 |  |                     if (_httpResponse != null) | 
|  |  | 592 |  |                     { | 
|  | 0 | 593 |  |                         _httpResponse.Dispose(); | 
|  |  | 594 |  |                     } | 
|  | 0 | 595 |  |                     throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); | 
|  |  | 596 |  |                 } | 
|  |  | 597 |  |             } | 
|  | 1 | 598 |  |             if (_shouldTrace) | 
|  |  | 599 |  |             { | 
|  | 0 | 600 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 601 |  |             } | 
|  | 1 | 602 |  |             return _result; | 
|  | 1 | 603 |  |         } | 
|  |  | 604 |  |  | 
|  |  | 605 |  |         /// <summary> | 
|  |  | 606 |  |         /// A job Id will be returned for the content posted on this endpoint. | 
|  |  | 607 |  |         /// | 
|  |  | 608 |  |         /// Once the content is evaluated against the Workflow provided the review will | 
|  |  | 609 |  |         /// be created or ignored based on the workflow expression. | 
|  |  | 610 |  |         /// | 
|  |  | 611 |  |         /// <h3>CallBack Schemas </h3> | 
|  |  | 612 |  |         /// | 
|  |  | 613 |  |         /// <p> | 
|  |  | 614 |  |         /// <h4>Job Completion CallBack Sample</h4><br/> | 
|  |  | 615 |  |         /// | 
|  |  | 616 |  |         /// {<br/> | 
|  |  | 617 |  |         /// "JobId": "<Job Id>,<br/> | 
|  |  | 618 |  |         /// "ReviewId": "<Review Id, if the Job resulted in a Review to be | 
|  |  | 619 |  |         /// created>",<br/> | 
|  |  | 620 |  |         /// "WorkFlowId": "default",<br/> | 
|  |  | 621 |  |         /// "Status": "<This will be one of Complete, InProgress, | 
|  |  | 622 |  |         /// Error>",<br/> | 
|  |  | 623 |  |         /// "ContentType": "Image",<br/> | 
|  |  | 624 |  |         /// "ContentId": "<This is the ContentId that was specified on | 
|  |  | 625 |  |         /// input>",<br/> | 
|  |  | 626 |  |         /// "CallBackType": "Job",<br/> | 
|  |  | 627 |  |         /// "Metadata": {<br/> | 
|  |  | 628 |  |         /// "adultscore": "0.xxx",<br/> | 
|  |  | 629 |  |         /// "a": "False",<br/> | 
|  |  | 630 |  |         /// "racyscore": "0.xxx",<br/> | 
|  |  | 631 |  |         /// "r": "True"<br/> | 
|  |  | 632 |  |         /// }<br/> | 
|  |  | 633 |  |         /// }<br/> | 
|  |  | 634 |  |         /// | 
|  |  | 635 |  |         /// </p> | 
|  |  | 636 |  |         /// <p> | 
|  |  | 637 |  |         /// <h4>Review Completion CallBack Sample</h4><br/> | 
|  |  | 638 |  |         /// | 
|  |  | 639 |  |         /// { | 
|  |  | 640 |  |         /// "ReviewId": "<Review Id>",<br/> | 
|  |  | 641 |  |         /// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/> | 
|  |  | 642 |  |         /// "ModifiedBy": "<Name of the Reviewer>",<br/> | 
|  |  | 643 |  |         /// "CallBackType": "Review",<br/> | 
|  |  | 644 |  |         /// "ContentId": "<The ContentId that was specified input>",<br/> | 
|  |  | 645 |  |         /// "Metadata": {<br/> | 
|  |  | 646 |  |         /// "adultscore": "0.xxx", | 
|  |  | 647 |  |         /// "a": "False",<br/> | 
|  |  | 648 |  |         /// "racyscore": "0.xxx",<br/> | 
|  |  | 649 |  |         /// "r": "True"<br/> | 
|  |  | 650 |  |         /// },<br/> | 
|  |  | 651 |  |         /// "ReviewerResultTags": {<br/> | 
|  |  | 652 |  |         /// "a": "False",<br/> | 
|  |  | 653 |  |         /// "r": "True"<br/> | 
|  |  | 654 |  |         /// }<br/> | 
|  |  | 655 |  |         /// }<br/> | 
|  |  | 656 |  |         /// | 
|  |  | 657 |  |         /// </p>. | 
|  |  | 658 |  |         /// </summary> | 
|  |  | 659 |  |         /// <param name='teamName'> | 
|  |  | 660 |  |         /// Your team name. | 
|  |  | 661 |  |         /// </param> | 
|  |  | 662 |  |         /// <param name='contentType'> | 
|  |  | 663 |  |         /// Image, Text or Video. Possible values include: 'Image', 'Text', 'Video' | 
|  |  | 664 |  |         /// </param> | 
|  |  | 665 |  |         /// <param name='contentId'> | 
|  |  | 666 |  |         /// Id/Name to identify the content submitted. | 
|  |  | 667 |  |         /// </param> | 
|  |  | 668 |  |         /// <param name='workflowName'> | 
|  |  | 669 |  |         /// Workflow Name that you want to invoke. | 
|  |  | 670 |  |         /// </param> | 
|  |  | 671 |  |         /// <param name='jobContentType'> | 
|  |  | 672 |  |         /// The content type. Possible values include: 'application/json', 'image/jpeg' | 
|  |  | 673 |  |         /// </param> | 
|  |  | 674 |  |         /// <param name='content'> | 
|  |  | 675 |  |         /// Content to evaluate. | 
|  |  | 676 |  |         /// </param> | 
|  |  | 677 |  |         /// <param name='callBackEndpoint'> | 
|  |  | 678 |  |         /// Callback endpoint for posting the create job result. | 
|  |  | 679 |  |         /// </param> | 
|  |  | 680 |  |         /// <param name='customHeaders'> | 
|  |  | 681 |  |         /// Headers that will be added to request. | 
|  |  | 682 |  |         /// </param> | 
|  |  | 683 |  |         /// <param name='cancellationToken'> | 
|  |  | 684 |  |         /// The cancellation token. | 
|  |  | 685 |  |         /// </param> | 
|  |  | 686 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 687 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 688 |  |         /// </exception> | 
|  |  | 689 |  |         /// <exception cref="SerializationException"> | 
|  |  | 690 |  |         /// Thrown when unable to deserialize the response | 
|  |  | 691 |  |         /// </exception> | 
|  |  | 692 |  |         /// <exception cref="ValidationException"> | 
|  |  | 693 |  |         /// Thrown when a required parameter is null | 
|  |  | 694 |  |         /// </exception> | 
|  |  | 695 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 696 |  |         /// Thrown when a required parameter is null | 
|  |  | 697 |  |         /// </exception> | 
|  |  | 698 |  |         /// <return> | 
|  |  | 699 |  |         /// A response object containing the response body and response headers. | 
|  |  | 700 |  |         /// </return> | 
|  |  | 701 |  |         public async Task<HttpOperationResponse<JobId>> CreateJobWithHttpMessagesAsync(string teamName, string contentTy | 
|  |  | 702 |  |         { | 
|  | 1 | 703 |  |             if (Client.Endpoint == null) | 
|  |  | 704 |  |             { | 
|  | 0 | 705 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 706 |  |             } | 
|  | 1 | 707 |  |             if (teamName == null) | 
|  |  | 708 |  |             { | 
|  | 0 | 709 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 710 |  |             } | 
|  | 1 | 711 |  |             if (contentType == null) | 
|  |  | 712 |  |             { | 
|  | 0 | 713 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); | 
|  |  | 714 |  |             } | 
|  | 1 | 715 |  |             if (contentId == null) | 
|  |  | 716 |  |             { | 
|  | 0 | 717 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "contentId"); | 
|  |  | 718 |  |             } | 
|  | 1 | 719 |  |             if (workflowName == null) | 
|  |  | 720 |  |             { | 
|  | 0 | 721 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "workflowName"); | 
|  |  | 722 |  |             } | 
|  | 1 | 723 |  |             if (jobContentType == null) | 
|  |  | 724 |  |             { | 
|  | 0 | 725 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "jobContentType"); | 
|  |  | 726 |  |             } | 
|  | 1 | 727 |  |             if (content == null) | 
|  |  | 728 |  |             { | 
|  | 0 | 729 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "content"); | 
|  |  | 730 |  |             } | 
|  | 1 | 731 |  |             if (content != null) | 
|  |  | 732 |  |             { | 
|  | 1 | 733 |  |                 content.Validate(); | 
|  |  | 734 |  |             } | 
|  |  | 735 |  |             // Tracing | 
|  | 1 | 736 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  | 1 | 737 |  |             string _invocationId = null; | 
|  | 1 | 738 |  |             if (_shouldTrace) | 
|  |  | 739 |  |             { | 
|  | 0 | 740 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  | 0 | 741 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  | 0 | 742 |  |                 tracingParameters.Add("teamName", teamName); | 
|  | 0 | 743 |  |                 tracingParameters.Add("contentType", contentType); | 
|  | 0 | 744 |  |                 tracingParameters.Add("contentId", contentId); | 
|  | 0 | 745 |  |                 tracingParameters.Add("workflowName", workflowName); | 
|  | 0 | 746 |  |                 tracingParameters.Add("callBackEndpoint", callBackEndpoint); | 
|  | 0 | 747 |  |                 tracingParameters.Add("jobContentType", jobContentType); | 
|  | 0 | 748 |  |                 tracingParameters.Add("content", content); | 
|  | 0 | 749 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  | 0 | 750 |  |                 ServiceClientTracing.Enter(_invocationId, this, "CreateJob", tracingParameters); | 
|  |  | 751 |  |             } | 
|  |  | 752 |  |             // Construct URL | 
|  | 1 | 753 |  |             var _baseUrl = Client.BaseUri; | 
|  | 1 | 754 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/j | 
|  | 1 | 755 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  | 1 | 756 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  | 1 | 757 |  |             List<string> _queryParameters = new List<string>(); | 
|  | 1 | 758 |  |             if (contentType != null) | 
|  |  | 759 |  |             { | 
|  | 1 | 760 |  |                 _queryParameters.Add(string.Format("ContentType={0}", System.Uri.EscapeDataString(Rest.Serialization.Saf | 
|  |  | 761 |  |             } | 
|  | 1 | 762 |  |             if (contentId != null) | 
|  |  | 763 |  |             { | 
|  | 1 | 764 |  |                 _queryParameters.Add(string.Format("ContentId={0}", System.Uri.EscapeDataString(contentId))); | 
|  |  | 765 |  |             } | 
|  | 1 | 766 |  |             if (workflowName != null) | 
|  |  | 767 |  |             { | 
|  | 1 | 768 |  |                 _queryParameters.Add(string.Format("WorkflowName={0}", System.Uri.EscapeDataString(workflowName))); | 
|  |  | 769 |  |             } | 
|  | 1 | 770 |  |             if (callBackEndpoint != null) | 
|  |  | 771 |  |             { | 
|  | 0 | 772 |  |                 _queryParameters.Add(string.Format("CallBackEndpoint={0}", System.Uri.EscapeDataString(callBackEndpoint) | 
|  |  | 773 |  |             } | 
|  | 1 | 774 |  |             if (_queryParameters.Count > 0) | 
|  |  | 775 |  |             { | 
|  | 1 | 776 |  |                 _url += "?" + string.Join("&", _queryParameters); | 
|  |  | 777 |  |             } | 
|  |  | 778 |  |             // Create HTTP transport objects | 
|  | 1 | 779 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  | 1 | 780 |  |             HttpResponseMessage _httpResponse = null; | 
|  | 1 | 781 |  |             _httpRequest.Method = new HttpMethod("POST"); | 
|  | 1 | 782 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 783 |  |             // Set Headers | 
|  |  | 784 |  |  | 
|  |  | 785 |  |  | 
|  | 1 | 786 |  |             if (customHeaders != null) | 
|  |  | 787 |  |             { | 
|  | 0 | 788 |  |                 foreach(var _header in customHeaders) | 
|  |  | 789 |  |                 { | 
|  | 0 | 790 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 791 |  |                     { | 
|  | 0 | 792 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 793 |  |                     } | 
|  | 0 | 794 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 795 |  |                 } | 
|  |  | 796 |  |             } | 
|  |  | 797 |  |  | 
|  |  | 798 |  |             // Serialize Request | 
|  | 1 | 799 |  |             string _requestContent = null; | 
|  | 1 | 800 |  |             if(content != null) | 
|  |  | 801 |  |             { | 
|  | 1 | 802 |  |                 _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(content, Client.SerializationSettin | 
|  | 1 | 803 |  |                 _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); | 
|  | 1 | 804 |  |                 _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); | 
|  |  | 805 |  |             } | 
|  |  | 806 |  |             // Set Credentials | 
|  | 1 | 807 |  |             if (Client.Credentials != null) | 
|  |  | 808 |  |             { | 
|  | 1 | 809 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  | 1 | 810 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 811 |  |             } | 
|  |  | 812 |  |             // Send Request | 
|  | 1 | 813 |  |             if (_shouldTrace) | 
|  |  | 814 |  |             { | 
|  | 0 | 815 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 816 |  |             } | 
|  | 1 | 817 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 1 | 818 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  | 1 | 819 |  |             if (_shouldTrace) | 
|  |  | 820 |  |             { | 
|  | 0 | 821 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 822 |  |             } | 
|  | 1 | 823 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  | 1 | 824 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 1 | 825 |  |             string _responseContent = null; | 
|  | 1 | 826 |  |             if ((int)_statusCode != 200) | 
|  |  | 827 |  |             { | 
|  | 0 | 828 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 829 |  |                 try | 
|  |  | 830 |  |                 { | 
|  | 0 | 831 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  | 0 | 832 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  | 0 | 833 |  |                     if (_errorBody != null) | 
|  |  | 834 |  |                     { | 
|  | 0 | 835 |  |                         ex.Body = _errorBody; | 
|  |  | 836 |  |                     } | 
|  | 0 | 837 |  |                 } | 
|  | 0 | 838 |  |                 catch (JsonException) | 
|  |  | 839 |  |                 { | 
|  |  | 840 |  |                     // Ignore the exception | 
|  | 0 | 841 |  |                 } | 
|  | 0 | 842 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  | 0 | 843 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  | 0 | 844 |  |                 if (_shouldTrace) | 
|  |  | 845 |  |                 { | 
|  | 0 | 846 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 847 |  |                 } | 
|  | 0 | 848 |  |                 _httpRequest.Dispose(); | 
|  | 0 | 849 |  |                 if (_httpResponse != null) | 
|  |  | 850 |  |                 { | 
|  | 0 | 851 |  |                     _httpResponse.Dispose(); | 
|  |  | 852 |  |                 } | 
|  | 0 | 853 |  |                 throw ex; | 
|  |  | 854 |  |             } | 
|  |  | 855 |  |             // Create Result | 
|  | 1 | 856 |  |             var _result = new HttpOperationResponse<JobId>(); | 
|  | 1 | 857 |  |             _result.Request = _httpRequest; | 
|  | 1 | 858 |  |             _result.Response = _httpResponse; | 
|  |  | 859 |  |             // Deserialize Response | 
|  | 1 | 860 |  |             if ((int)_statusCode == 200) | 
|  |  | 861 |  |             { | 
|  | 1 | 862 |  |                 _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  |  | 863 |  |                 try | 
|  |  | 864 |  |                 { | 
|  | 1 | 865 |  |                     _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<JobId>(_responseContent, Client. | 
|  | 1 | 866 |  |                 } | 
|  | 0 | 867 |  |                 catch (JsonException ex) | 
|  |  | 868 |  |                 { | 
|  | 0 | 869 |  |                     _httpRequest.Dispose(); | 
|  | 0 | 870 |  |                     if (_httpResponse != null) | 
|  |  | 871 |  |                     { | 
|  | 0 | 872 |  |                         _httpResponse.Dispose(); | 
|  |  | 873 |  |                     } | 
|  | 0 | 874 |  |                     throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); | 
|  |  | 875 |  |                 } | 
|  |  | 876 |  |             } | 
|  | 1 | 877 |  |             if (_shouldTrace) | 
|  |  | 878 |  |             { | 
|  | 0 | 879 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 880 |  |             } | 
|  | 1 | 881 |  |             return _result; | 
|  | 1 | 882 |  |         } | 
|  |  | 883 |  |  | 
|  |  | 884 |  |         /// <summary> | 
|  |  | 885 |  |         /// The reviews created would show up for Reviewers on your team. As Reviewers | 
|  |  | 886 |  |         /// complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) | 
|  |  | 887 |  |         /// on the specified CallBackEndpoint. | 
|  |  | 888 |  |         /// | 
|  |  | 889 |  |         /// <h3>CallBack Schemas </h3> | 
|  |  | 890 |  |         /// <h4>Review Completion CallBack Sample</h4> | 
|  |  | 891 |  |         /// <p> | 
|  |  | 892 |  |         /// {<br/> | 
|  |  | 893 |  |         /// "ReviewId": "<Review Id>",<br/> | 
|  |  | 894 |  |         /// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/> | 
|  |  | 895 |  |         /// "ModifiedBy": "<Name of the Reviewer>",<br/> | 
|  |  | 896 |  |         /// "CallBackType": "Review",<br/> | 
|  |  | 897 |  |         /// "ContentId": "<The ContentId that was specified input>",<br/> | 
|  |  | 898 |  |         /// "Metadata": {<br/> | 
|  |  | 899 |  |         /// "adultscore": "0.xxx",<br/> | 
|  |  | 900 |  |         /// "a": "False",<br/> | 
|  |  | 901 |  |         /// "racyscore": "0.xxx",<br/> | 
|  |  | 902 |  |         /// "r": "True"<br/> | 
|  |  | 903 |  |         /// },<br/> | 
|  |  | 904 |  |         /// "ReviewerResultTags": {<br/> | 
|  |  | 905 |  |         /// "a": "False",<br/> | 
|  |  | 906 |  |         /// "r": "True"<br/> | 
|  |  | 907 |  |         /// }<br/> | 
|  |  | 908 |  |         /// }<br/> | 
|  |  | 909 |  |         /// | 
|  |  | 910 |  |         /// </p>. | 
|  |  | 911 |  |         /// </summary> | 
|  |  | 912 |  |         /// <param name='teamName'> | 
|  |  | 913 |  |         /// Your team name. | 
|  |  | 914 |  |         /// </param> | 
|  |  | 915 |  |         /// <param name='reviewId'> | 
|  |  | 916 |  |         /// Id of the review. | 
|  |  | 917 |  |         /// </param> | 
|  |  | 918 |  |         /// <param name='timescale'> | 
|  |  | 919 |  |         /// Timescale of the video you are adding frames to. | 
|  |  | 920 |  |         /// </param> | 
|  |  | 921 |  |         /// <param name='customHeaders'> | 
|  |  | 922 |  |         /// Headers that will be added to request. | 
|  |  | 923 |  |         /// </param> | 
|  |  | 924 |  |         /// <param name='cancellationToken'> | 
|  |  | 925 |  |         /// The cancellation token. | 
|  |  | 926 |  |         /// </param> | 
|  |  | 927 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 928 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 929 |  |         /// </exception> | 
|  |  | 930 |  |         /// <exception cref="ValidationException"> | 
|  |  | 931 |  |         /// Thrown when a required parameter is null | 
|  |  | 932 |  |         /// </exception> | 
|  |  | 933 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 934 |  |         /// Thrown when a required parameter is null | 
|  |  | 935 |  |         /// </exception> | 
|  |  | 936 |  |         /// <return> | 
|  |  | 937 |  |         /// A response object containing the response body and response headers. | 
|  |  | 938 |  |         /// </return> | 
|  |  | 939 |  |         public async Task<HttpOperationResponse> AddVideoFrameWithHttpMessagesAsync(string teamName, string reviewId, in | 
|  |  | 940 |  |         { | 
|  | 0 | 941 |  |             if (Client.Endpoint == null) | 
|  |  | 942 |  |             { | 
|  | 0 | 943 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 944 |  |             } | 
|  | 0 | 945 |  |             if (teamName == null) | 
|  |  | 946 |  |             { | 
|  | 0 | 947 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 948 |  |             } | 
|  | 0 | 949 |  |             if (reviewId == null) | 
|  |  | 950 |  |             { | 
|  | 0 | 951 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "reviewId"); | 
|  |  | 952 |  |             } | 
|  |  | 953 |  |             // Tracing | 
|  | 0 | 954 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  | 0 | 955 |  |             string _invocationId = null; | 
|  | 0 | 956 |  |             if (_shouldTrace) | 
|  |  | 957 |  |             { | 
|  | 0 | 958 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  | 0 | 959 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  | 0 | 960 |  |                 tracingParameters.Add("teamName", teamName); | 
|  | 0 | 961 |  |                 tracingParameters.Add("reviewId", reviewId); | 
|  | 0 | 962 |  |                 tracingParameters.Add("timescale", timescale); | 
|  | 0 | 963 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  | 0 | 964 |  |                 ServiceClientTracing.Enter(_invocationId, this, "AddVideoFrame", tracingParameters); | 
|  |  | 965 |  |             } | 
|  |  | 966 |  |             // Construct URL | 
|  | 0 | 967 |  |             var _baseUrl = Client.BaseUri; | 
|  | 0 | 968 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r | 
|  | 0 | 969 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  | 0 | 970 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  | 0 | 971 |  |             _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId)); | 
|  | 0 | 972 |  |             List<string> _queryParameters = new List<string>(); | 
|  | 0 | 973 |  |             if (timescale != null) | 
|  |  | 974 |  |             { | 
|  | 0 | 975 |  |                 _queryParameters.Add(string.Format("timescale={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJ | 
|  |  | 976 |  |             } | 
|  | 0 | 977 |  |             if (_queryParameters.Count > 0) | 
|  |  | 978 |  |             { | 
|  | 0 | 979 |  |                 _url += "?" + string.Join("&", _queryParameters); | 
|  |  | 980 |  |             } | 
|  |  | 981 |  |             // Create HTTP transport objects | 
|  | 0 | 982 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  | 0 | 983 |  |             HttpResponseMessage _httpResponse = null; | 
|  | 0 | 984 |  |             _httpRequest.Method = new HttpMethod("POST"); | 
|  | 0 | 985 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 986 |  |             // Set Headers | 
|  |  | 987 |  |  | 
|  |  | 988 |  |  | 
|  | 0 | 989 |  |             if (customHeaders != null) | 
|  |  | 990 |  |             { | 
|  | 0 | 991 |  |                 foreach(var _header in customHeaders) | 
|  |  | 992 |  |                 { | 
|  | 0 | 993 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 994 |  |                     { | 
|  | 0 | 995 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 996 |  |                     } | 
|  | 0 | 997 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 998 |  |                 } | 
|  |  | 999 |  |             } | 
|  |  | 1000 |  |  | 
|  |  | 1001 |  |             // Serialize Request | 
|  | 0 | 1002 |  |             string _requestContent = null; | 
|  |  | 1003 |  |             // Set Credentials | 
|  | 0 | 1004 |  |             if (Client.Credentials != null) | 
|  |  | 1005 |  |             { | 
|  | 0 | 1006 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1007 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 1008 |  |             } | 
|  |  | 1009 |  |             // Send Request | 
|  | 0 | 1010 |  |             if (_shouldTrace) | 
|  |  | 1011 |  |             { | 
|  | 0 | 1012 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 1013 |  |             } | 
|  | 0 | 1014 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1015 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  | 0 | 1016 |  |             if (_shouldTrace) | 
|  |  | 1017 |  |             { | 
|  | 0 | 1018 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 1019 |  |             } | 
|  | 0 | 1020 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  | 0 | 1021 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1022 |  |             string _responseContent = null; | 
|  | 0 | 1023 |  |             if ((int)_statusCode != 200) | 
|  |  | 1024 |  |             { | 
|  | 0 | 1025 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 1026 |  |                 try | 
|  |  | 1027 |  |                 { | 
|  | 0 | 1028 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  | 0 | 1029 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  | 0 | 1030 |  |                     if (_errorBody != null) | 
|  |  | 1031 |  |                     { | 
|  | 0 | 1032 |  |                         ex.Body = _errorBody; | 
|  |  | 1033 |  |                     } | 
|  | 0 | 1034 |  |                 } | 
|  | 0 | 1035 |  |                 catch (JsonException) | 
|  |  | 1036 |  |                 { | 
|  |  | 1037 |  |                     // Ignore the exception | 
|  | 0 | 1038 |  |                 } | 
|  | 0 | 1039 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  | 0 | 1040 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  | 0 | 1041 |  |                 if (_shouldTrace) | 
|  |  | 1042 |  |                 { | 
|  | 0 | 1043 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 1044 |  |                 } | 
|  | 0 | 1045 |  |                 _httpRequest.Dispose(); | 
|  | 0 | 1046 |  |                 if (_httpResponse != null) | 
|  |  | 1047 |  |                 { | 
|  | 0 | 1048 |  |                     _httpResponse.Dispose(); | 
|  |  | 1049 |  |                 } | 
|  | 0 | 1050 |  |                 throw ex; | 
|  |  | 1051 |  |             } | 
|  |  | 1052 |  |             // Create Result | 
|  | 0 | 1053 |  |             var _result = new HttpOperationResponse(); | 
|  | 0 | 1054 |  |             _result.Request = _httpRequest; | 
|  | 0 | 1055 |  |             _result.Response = _httpResponse; | 
|  | 0 | 1056 |  |             if (_shouldTrace) | 
|  |  | 1057 |  |             { | 
|  | 0 | 1058 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 1059 |  |             } | 
|  | 0 | 1060 |  |             return _result; | 
|  | 0 | 1061 |  |         } | 
|  |  | 1062 |  |  | 
|  |  | 1063 |  |         /// <summary> | 
|  |  | 1064 |  |         /// The reviews created would show up for Reviewers on your team. As Reviewers | 
|  |  | 1065 |  |         /// complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) | 
|  |  | 1066 |  |         /// on the specified CallBackEndpoint. | 
|  |  | 1067 |  |         /// | 
|  |  | 1068 |  |         /// <h3>CallBack Schemas </h3> | 
|  |  | 1069 |  |         /// <h4>Review Completion CallBack Sample</h4> | 
|  |  | 1070 |  |         /// <p> | 
|  |  | 1071 |  |         /// {<br/> | 
|  |  | 1072 |  |         /// "ReviewId": "<Review Id>",<br/> | 
|  |  | 1073 |  |         /// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/> | 
|  |  | 1074 |  |         /// "ModifiedBy": "<Name of the Reviewer>",<br/> | 
|  |  | 1075 |  |         /// "CallBackType": "Review",<br/> | 
|  |  | 1076 |  |         /// "ContentId": "<The ContentId that was specified input>",<br/> | 
|  |  | 1077 |  |         /// "Metadata": {<br/> | 
|  |  | 1078 |  |         /// "adultscore": "0.xxx",<br/> | 
|  |  | 1079 |  |         /// "a": "False",<br/> | 
|  |  | 1080 |  |         /// "racyscore": "0.xxx",<br/> | 
|  |  | 1081 |  |         /// "r": "True"<br/> | 
|  |  | 1082 |  |         /// },<br/> | 
|  |  | 1083 |  |         /// "ReviewerResultTags": {<br/> | 
|  |  | 1084 |  |         /// "a": "False",<br/> | 
|  |  | 1085 |  |         /// "r": "True"<br/> | 
|  |  | 1086 |  |         /// }<br/> | 
|  |  | 1087 |  |         /// }<br/> | 
|  |  | 1088 |  |         /// | 
|  |  | 1089 |  |         /// </p>. | 
|  |  | 1090 |  |         /// </summary> | 
|  |  | 1091 |  |         /// <param name='teamName'> | 
|  |  | 1092 |  |         /// Your team name. | 
|  |  | 1093 |  |         /// </param> | 
|  |  | 1094 |  |         /// <param name='reviewId'> | 
|  |  | 1095 |  |         /// Id of the review. | 
|  |  | 1096 |  |         /// </param> | 
|  |  | 1097 |  |         /// <param name='startSeed'> | 
|  |  | 1098 |  |         /// Time stamp of the frame from where you want to start fetching the frames. | 
|  |  | 1099 |  |         /// </param> | 
|  |  | 1100 |  |         /// <param name='noOfRecords'> | 
|  |  | 1101 |  |         /// Number of frames to fetch. | 
|  |  | 1102 |  |         /// </param> | 
|  |  | 1103 |  |         /// <param name='filter'> | 
|  |  | 1104 |  |         /// Get frames filtered by tags. | 
|  |  | 1105 |  |         /// </param> | 
|  |  | 1106 |  |         /// <param name='customHeaders'> | 
|  |  | 1107 |  |         /// Headers that will be added to request. | 
|  |  | 1108 |  |         /// </param> | 
|  |  | 1109 |  |         /// <param name='cancellationToken'> | 
|  |  | 1110 |  |         /// The cancellation token. | 
|  |  | 1111 |  |         /// </param> | 
|  |  | 1112 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 1113 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 1114 |  |         /// </exception> | 
|  |  | 1115 |  |         /// <exception cref="SerializationException"> | 
|  |  | 1116 |  |         /// Thrown when unable to deserialize the response | 
|  |  | 1117 |  |         /// </exception> | 
|  |  | 1118 |  |         /// <exception cref="ValidationException"> | 
|  |  | 1119 |  |         /// Thrown when a required parameter is null | 
|  |  | 1120 |  |         /// </exception> | 
|  |  | 1121 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 1122 |  |         /// Thrown when a required parameter is null | 
|  |  | 1123 |  |         /// </exception> | 
|  |  | 1124 |  |         /// <return> | 
|  |  | 1125 |  |         /// A response object containing the response body and response headers. | 
|  |  | 1126 |  |         /// </return> | 
|  |  | 1127 |  |         public async Task<HttpOperationResponse<Frames>> GetVideoFramesWithHttpMessagesAsync(string teamName, string rev | 
|  |  | 1128 |  |         { | 
|  | 0 | 1129 |  |             if (Client.Endpoint == null) | 
|  |  | 1130 |  |             { | 
|  | 0 | 1131 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 1132 |  |             } | 
|  | 0 | 1133 |  |             if (teamName == null) | 
|  |  | 1134 |  |             { | 
|  | 0 | 1135 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 1136 |  |             } | 
|  | 0 | 1137 |  |             if (reviewId == null) | 
|  |  | 1138 |  |             { | 
|  | 0 | 1139 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "reviewId"); | 
|  |  | 1140 |  |             } | 
|  |  | 1141 |  |             // Tracing | 
|  | 0 | 1142 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  | 0 | 1143 |  |             string _invocationId = null; | 
|  | 0 | 1144 |  |             if (_shouldTrace) | 
|  |  | 1145 |  |             { | 
|  | 0 | 1146 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  | 0 | 1147 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  | 0 | 1148 |  |                 tracingParameters.Add("teamName", teamName); | 
|  | 0 | 1149 |  |                 tracingParameters.Add("reviewId", reviewId); | 
|  | 0 | 1150 |  |                 tracingParameters.Add("startSeed", startSeed); | 
|  | 0 | 1151 |  |                 tracingParameters.Add("noOfRecords", noOfRecords); | 
|  | 0 | 1152 |  |                 tracingParameters.Add("filter", filter); | 
|  | 0 | 1153 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  | 0 | 1154 |  |                 ServiceClientTracing.Enter(_invocationId, this, "GetVideoFrames", tracingParameters); | 
|  |  | 1155 |  |             } | 
|  |  | 1156 |  |             // Construct URL | 
|  | 0 | 1157 |  |             var _baseUrl = Client.BaseUri; | 
|  | 0 | 1158 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r | 
|  | 0 | 1159 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  | 0 | 1160 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  | 0 | 1161 |  |             _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId)); | 
|  | 0 | 1162 |  |             List<string> _queryParameters = new List<string>(); | 
|  | 0 | 1163 |  |             if (startSeed != null) | 
|  |  | 1164 |  |             { | 
|  | 0 | 1165 |  |                 _queryParameters.Add(string.Format("startSeed={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJ | 
|  |  | 1166 |  |             } | 
|  | 0 | 1167 |  |             if (noOfRecords != null) | 
|  |  | 1168 |  |             { | 
|  | 0 | 1169 |  |                 _queryParameters.Add(string.Format("noOfRecords={0}", System.Uri.EscapeDataString(Rest.Serialization.Saf | 
|  |  | 1170 |  |             } | 
|  | 0 | 1171 |  |             if (filter != null) | 
|  |  | 1172 |  |             { | 
|  | 0 | 1173 |  |                 _queryParameters.Add(string.Format("filter={0}", System.Uri.EscapeDataString(filter))); | 
|  |  | 1174 |  |             } | 
|  | 0 | 1175 |  |             if (_queryParameters.Count > 0) | 
|  |  | 1176 |  |             { | 
|  | 0 | 1177 |  |                 _url += "?" + string.Join("&", _queryParameters); | 
|  |  | 1178 |  |             } | 
|  |  | 1179 |  |             // Create HTTP transport objects | 
|  | 0 | 1180 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  | 0 | 1181 |  |             HttpResponseMessage _httpResponse = null; | 
|  | 0 | 1182 |  |             _httpRequest.Method = new HttpMethod("GET"); | 
|  | 0 | 1183 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 1184 |  |             // Set Headers | 
|  |  | 1185 |  |  | 
|  |  | 1186 |  |  | 
|  | 0 | 1187 |  |             if (customHeaders != null) | 
|  |  | 1188 |  |             { | 
|  | 0 | 1189 |  |                 foreach(var _header in customHeaders) | 
|  |  | 1190 |  |                 { | 
|  | 0 | 1191 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 1192 |  |                     { | 
|  | 0 | 1193 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 1194 |  |                     } | 
|  | 0 | 1195 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 1196 |  |                 } | 
|  |  | 1197 |  |             } | 
|  |  | 1198 |  |  | 
|  |  | 1199 |  |             // Serialize Request | 
|  | 0 | 1200 |  |             string _requestContent = null; | 
|  |  | 1201 |  |             // Set Credentials | 
|  | 0 | 1202 |  |             if (Client.Credentials != null) | 
|  |  | 1203 |  |             { | 
|  | 0 | 1204 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1205 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 1206 |  |             } | 
|  |  | 1207 |  |             // Send Request | 
|  | 0 | 1208 |  |             if (_shouldTrace) | 
|  |  | 1209 |  |             { | 
|  | 0 | 1210 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 1211 |  |             } | 
|  | 0 | 1212 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1213 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  | 0 | 1214 |  |             if (_shouldTrace) | 
|  |  | 1215 |  |             { | 
|  | 0 | 1216 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 1217 |  |             } | 
|  | 0 | 1218 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  | 0 | 1219 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1220 |  |             string _responseContent = null; | 
|  | 0 | 1221 |  |             if ((int)_statusCode != 200) | 
|  |  | 1222 |  |             { | 
|  | 0 | 1223 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 1224 |  |                 try | 
|  |  | 1225 |  |                 { | 
|  | 0 | 1226 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  | 0 | 1227 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  | 0 | 1228 |  |                     if (_errorBody != null) | 
|  |  | 1229 |  |                     { | 
|  | 0 | 1230 |  |                         ex.Body = _errorBody; | 
|  |  | 1231 |  |                     } | 
|  | 0 | 1232 |  |                 } | 
|  | 0 | 1233 |  |                 catch (JsonException) | 
|  |  | 1234 |  |                 { | 
|  |  | 1235 |  |                     // Ignore the exception | 
|  | 0 | 1236 |  |                 } | 
|  | 0 | 1237 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  | 0 | 1238 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  | 0 | 1239 |  |                 if (_shouldTrace) | 
|  |  | 1240 |  |                 { | 
|  | 0 | 1241 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 1242 |  |                 } | 
|  | 0 | 1243 |  |                 _httpRequest.Dispose(); | 
|  | 0 | 1244 |  |                 if (_httpResponse != null) | 
|  |  | 1245 |  |                 { | 
|  | 0 | 1246 |  |                     _httpResponse.Dispose(); | 
|  |  | 1247 |  |                 } | 
|  | 0 | 1248 |  |                 throw ex; | 
|  |  | 1249 |  |             } | 
|  |  | 1250 |  |             // Create Result | 
|  | 0 | 1251 |  |             var _result = new HttpOperationResponse<Frames>(); | 
|  | 0 | 1252 |  |             _result.Request = _httpRequest; | 
|  | 0 | 1253 |  |             _result.Response = _httpResponse; | 
|  |  | 1254 |  |             // Deserialize Response | 
|  | 0 | 1255 |  |             if ((int)_statusCode == 200) | 
|  |  | 1256 |  |             { | 
|  | 0 | 1257 |  |                 _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  |  | 1258 |  |                 try | 
|  |  | 1259 |  |                 { | 
|  | 0 | 1260 |  |                     _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Frames>(_responseContent, Client | 
|  | 0 | 1261 |  |                 } | 
|  | 0 | 1262 |  |                 catch (JsonException ex) | 
|  |  | 1263 |  |                 { | 
|  | 0 | 1264 |  |                     _httpRequest.Dispose(); | 
|  | 0 | 1265 |  |                     if (_httpResponse != null) | 
|  |  | 1266 |  |                     { | 
|  | 0 | 1267 |  |                         _httpResponse.Dispose(); | 
|  |  | 1268 |  |                     } | 
|  | 0 | 1269 |  |                     throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); | 
|  |  | 1270 |  |                 } | 
|  |  | 1271 |  |             } | 
|  | 0 | 1272 |  |             if (_shouldTrace) | 
|  |  | 1273 |  |             { | 
|  | 0 | 1274 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 1275 |  |             } | 
|  | 0 | 1276 |  |             return _result; | 
|  | 0 | 1277 |  |         } | 
|  |  | 1278 |  |  | 
|  |  | 1279 |  |         /// <summary> | 
|  |  | 1280 |  |         /// Publish video review to make it available for review. | 
|  |  | 1281 |  |         /// </summary> | 
|  |  | 1282 |  |         /// <param name='teamName'> | 
|  |  | 1283 |  |         /// Your team name. | 
|  |  | 1284 |  |         /// </param> | 
|  |  | 1285 |  |         /// <param name='reviewId'> | 
|  |  | 1286 |  |         /// Id of the review. | 
|  |  | 1287 |  |         /// </param> | 
|  |  | 1288 |  |         /// <param name='customHeaders'> | 
|  |  | 1289 |  |         /// Headers that will be added to request. | 
|  |  | 1290 |  |         /// </param> | 
|  |  | 1291 |  |         /// <param name='cancellationToken'> | 
|  |  | 1292 |  |         /// The cancellation token. | 
|  |  | 1293 |  |         /// </param> | 
|  |  | 1294 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 1295 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 1296 |  |         /// </exception> | 
|  |  | 1297 |  |         /// <exception cref="ValidationException"> | 
|  |  | 1298 |  |         /// Thrown when a required parameter is null | 
|  |  | 1299 |  |         /// </exception> | 
|  |  | 1300 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 1301 |  |         /// Thrown when a required parameter is null | 
|  |  | 1302 |  |         /// </exception> | 
|  |  | 1303 |  |         /// <return> | 
|  |  | 1304 |  |         /// A response object containing the response body and response headers. | 
|  |  | 1305 |  |         /// </return> | 
|  |  | 1306 |  |         public async Task<HttpOperationResponse> PublishVideoReviewWithHttpMessagesAsync(string teamName, string reviewI | 
|  |  | 1307 |  |         { | 
|  | 0 | 1308 |  |             if (Client.Endpoint == null) | 
|  |  | 1309 |  |             { | 
|  | 0 | 1310 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 1311 |  |             } | 
|  | 0 | 1312 |  |             if (teamName == null) | 
|  |  | 1313 |  |             { | 
|  | 0 | 1314 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 1315 |  |             } | 
|  | 0 | 1316 |  |             if (reviewId == null) | 
|  |  | 1317 |  |             { | 
|  | 0 | 1318 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "reviewId"); | 
|  |  | 1319 |  |             } | 
|  |  | 1320 |  |             // Tracing | 
|  | 0 | 1321 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  | 0 | 1322 |  |             string _invocationId = null; | 
|  | 0 | 1323 |  |             if (_shouldTrace) | 
|  |  | 1324 |  |             { | 
|  | 0 | 1325 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  | 0 | 1326 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  | 0 | 1327 |  |                 tracingParameters.Add("teamName", teamName); | 
|  | 0 | 1328 |  |                 tracingParameters.Add("reviewId", reviewId); | 
|  | 0 | 1329 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  | 0 | 1330 |  |                 ServiceClientTracing.Enter(_invocationId, this, "PublishVideoReview", tracingParameters); | 
|  |  | 1331 |  |             } | 
|  |  | 1332 |  |             // Construct URL | 
|  | 0 | 1333 |  |             var _baseUrl = Client.BaseUri; | 
|  | 0 | 1334 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r | 
|  | 0 | 1335 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  | 0 | 1336 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  | 0 | 1337 |  |             _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId)); | 
|  |  | 1338 |  |             // Create HTTP transport objects | 
|  | 0 | 1339 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  | 0 | 1340 |  |             HttpResponseMessage _httpResponse = null; | 
|  | 0 | 1341 |  |             _httpRequest.Method = new HttpMethod("POST"); | 
|  | 0 | 1342 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 1343 |  |             // Set Headers | 
|  |  | 1344 |  |  | 
|  |  | 1345 |  |  | 
|  | 0 | 1346 |  |             if (customHeaders != null) | 
|  |  | 1347 |  |             { | 
|  | 0 | 1348 |  |                 foreach(var _header in customHeaders) | 
|  |  | 1349 |  |                 { | 
|  | 0 | 1350 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 1351 |  |                     { | 
|  | 0 | 1352 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 1353 |  |                     } | 
|  | 0 | 1354 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 1355 |  |                 } | 
|  |  | 1356 |  |             } | 
|  |  | 1357 |  |  | 
|  |  | 1358 |  |             // Serialize Request | 
|  | 0 | 1359 |  |             string _requestContent = null; | 
|  |  | 1360 |  |             // Set Credentials | 
|  | 0 | 1361 |  |             if (Client.Credentials != null) | 
|  |  | 1362 |  |             { | 
|  | 0 | 1363 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1364 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 1365 |  |             } | 
|  |  | 1366 |  |             // Send Request | 
|  | 0 | 1367 |  |             if (_shouldTrace) | 
|  |  | 1368 |  |             { | 
|  | 0 | 1369 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 1370 |  |             } | 
|  | 0 | 1371 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1372 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  | 0 | 1373 |  |             if (_shouldTrace) | 
|  |  | 1374 |  |             { | 
|  | 0 | 1375 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 1376 |  |             } | 
|  | 0 | 1377 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  | 0 | 1378 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1379 |  |             string _responseContent = null; | 
|  | 0 | 1380 |  |             if ((int)_statusCode != 204) | 
|  |  | 1381 |  |             { | 
|  | 0 | 1382 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 1383 |  |                 try | 
|  |  | 1384 |  |                 { | 
|  | 0 | 1385 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  | 0 | 1386 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  | 0 | 1387 |  |                     if (_errorBody != null) | 
|  |  | 1388 |  |                     { | 
|  | 0 | 1389 |  |                         ex.Body = _errorBody; | 
|  |  | 1390 |  |                     } | 
|  | 0 | 1391 |  |                 } | 
|  | 0 | 1392 |  |                 catch (JsonException) | 
|  |  | 1393 |  |                 { | 
|  |  | 1394 |  |                     // Ignore the exception | 
|  | 0 | 1395 |  |                 } | 
|  | 0 | 1396 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  | 0 | 1397 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  | 0 | 1398 |  |                 if (_shouldTrace) | 
|  |  | 1399 |  |                 { | 
|  | 0 | 1400 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 1401 |  |                 } | 
|  | 0 | 1402 |  |                 _httpRequest.Dispose(); | 
|  | 0 | 1403 |  |                 if (_httpResponse != null) | 
|  |  | 1404 |  |                 { | 
|  | 0 | 1405 |  |                     _httpResponse.Dispose(); | 
|  |  | 1406 |  |                 } | 
|  | 0 | 1407 |  |                 throw ex; | 
|  |  | 1408 |  |             } | 
|  |  | 1409 |  |             // Create Result | 
|  | 0 | 1410 |  |             var _result = new HttpOperationResponse(); | 
|  | 0 | 1411 |  |             _result.Request = _httpRequest; | 
|  | 0 | 1412 |  |             _result.Response = _httpResponse; | 
|  | 0 | 1413 |  |             if (_shouldTrace) | 
|  |  | 1414 |  |             { | 
|  | 0 | 1415 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 1416 |  |             } | 
|  | 0 | 1417 |  |             return _result; | 
|  | 0 | 1418 |  |         } | 
|  |  | 1419 |  |  | 
|  |  | 1420 |  |         /// <summary> | 
|  |  | 1421 |  |         /// This API adds a transcript screen text result file for a video review. | 
|  |  | 1422 |  |         /// Transcript screen text result file is a result of Screen Text API . In | 
|  |  | 1423 |  |         /// order to generate transcript screen text result file , a transcript file | 
|  |  | 1424 |  |         /// has to be screened for profanity using Screen Text API. | 
|  |  | 1425 |  |         /// </summary> | 
|  |  | 1426 |  |         /// <param name='contentType'> | 
|  |  | 1427 |  |         /// The content type. | 
|  |  | 1428 |  |         /// </param> | 
|  |  | 1429 |  |         /// <param name='teamName'> | 
|  |  | 1430 |  |         /// Your team name. | 
|  |  | 1431 |  |         /// </param> | 
|  |  | 1432 |  |         /// <param name='reviewId'> | 
|  |  | 1433 |  |         /// Id of the review. | 
|  |  | 1434 |  |         /// </param> | 
|  |  | 1435 |  |         /// <param name='transcriptModerationBody'> | 
|  |  | 1436 |  |         /// Body for add video transcript moderation result API | 
|  |  | 1437 |  |         /// </param> | 
|  |  | 1438 |  |         /// <param name='customHeaders'> | 
|  |  | 1439 |  |         /// Headers that will be added to request. | 
|  |  | 1440 |  |         /// </param> | 
|  |  | 1441 |  |         /// <param name='cancellationToken'> | 
|  |  | 1442 |  |         /// The cancellation token. | 
|  |  | 1443 |  |         /// </param> | 
|  |  | 1444 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 1445 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 1446 |  |         /// </exception> | 
|  |  | 1447 |  |         /// <exception cref="ValidationException"> | 
|  |  | 1448 |  |         /// Thrown when a required parameter is null | 
|  |  | 1449 |  |         /// </exception> | 
|  |  | 1450 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 1451 |  |         /// Thrown when a required parameter is null | 
|  |  | 1452 |  |         /// </exception> | 
|  |  | 1453 |  |         /// <return> | 
|  |  | 1454 |  |         /// A response object containing the response body and response headers. | 
|  |  | 1455 |  |         /// </return> | 
|  |  | 1456 |  |         public async Task<HttpOperationResponse> AddVideoTranscriptModerationResultWithHttpMessagesAsync(string contentT | 
|  |  | 1457 |  |         { | 
|  | 0 | 1458 |  |             if (Client.Endpoint == null) | 
|  |  | 1459 |  |             { | 
|  | 0 | 1460 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 1461 |  |             } | 
|  | 0 | 1462 |  |             if (contentType == null) | 
|  |  | 1463 |  |             { | 
|  | 0 | 1464 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); | 
|  |  | 1465 |  |             } | 
|  | 0 | 1466 |  |             if (teamName == null) | 
|  |  | 1467 |  |             { | 
|  | 0 | 1468 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 1469 |  |             } | 
|  | 0 | 1470 |  |             if (reviewId == null) | 
|  |  | 1471 |  |             { | 
|  | 0 | 1472 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "reviewId"); | 
|  |  | 1473 |  |             } | 
|  | 0 | 1474 |  |             if (transcriptModerationBody == null) | 
|  |  | 1475 |  |             { | 
|  | 0 | 1476 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "transcriptModerationBody"); | 
|  |  | 1477 |  |             } | 
|  | 0 | 1478 |  |             if (transcriptModerationBody != null) | 
|  |  | 1479 |  |             { | 
|  | 0 | 1480 |  |                 foreach (var element in transcriptModerationBody) | 
|  |  | 1481 |  |                 { | 
|  | 0 | 1482 |  |                     if (element != null) | 
|  |  | 1483 |  |                     { | 
|  | 0 | 1484 |  |                         element.Validate(); | 
|  |  | 1485 |  |                     } | 
|  |  | 1486 |  |                 } | 
|  |  | 1487 |  |             } | 
|  |  | 1488 |  |             // Tracing | 
|  | 0 | 1489 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  | 0 | 1490 |  |             string _invocationId = null; | 
|  | 0 | 1491 |  |             if (_shouldTrace) | 
|  |  | 1492 |  |             { | 
|  | 0 | 1493 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  | 0 | 1494 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  | 0 | 1495 |  |                 tracingParameters.Add("contentType", contentType); | 
|  | 0 | 1496 |  |                 tracingParameters.Add("teamName", teamName); | 
|  | 0 | 1497 |  |                 tracingParameters.Add("reviewId", reviewId); | 
|  | 0 | 1498 |  |                 tracingParameters.Add("transcriptModerationBody", transcriptModerationBody); | 
|  | 0 | 1499 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  | 0 | 1500 |  |                 ServiceClientTracing.Enter(_invocationId, this, "AddVideoTranscriptModerationResult", tracingParameters) | 
|  |  | 1501 |  |             } | 
|  |  | 1502 |  |             // Construct URL | 
|  | 0 | 1503 |  |             var _baseUrl = Client.BaseUri; | 
|  | 0 | 1504 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r | 
|  | 0 | 1505 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  | 0 | 1506 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  | 0 | 1507 |  |             _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId)); | 
|  |  | 1508 |  |             // Create HTTP transport objects | 
|  | 0 | 1509 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  | 0 | 1510 |  |             HttpResponseMessage _httpResponse = null; | 
|  | 0 | 1511 |  |             _httpRequest.Method = new HttpMethod("PUT"); | 
|  | 0 | 1512 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 1513 |  |             // Set Headers | 
|  |  | 1514 |  |  | 
|  |  | 1515 |  |  | 
|  | 0 | 1516 |  |             if (customHeaders != null) | 
|  |  | 1517 |  |             { | 
|  | 0 | 1518 |  |                 foreach(var _header in customHeaders) | 
|  |  | 1519 |  |                 { | 
|  | 0 | 1520 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 1521 |  |                     { | 
|  | 0 | 1522 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 1523 |  |                     } | 
|  | 0 | 1524 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 1525 |  |                 } | 
|  |  | 1526 |  |             } | 
|  |  | 1527 |  |  | 
|  |  | 1528 |  |             // Serialize Request | 
|  | 0 | 1529 |  |             string _requestContent = null; | 
|  | 0 | 1530 |  |             if(transcriptModerationBody != null) | 
|  |  | 1531 |  |             { | 
|  | 0 | 1532 |  |                 _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(transcriptModerationBody, Client.Se | 
|  | 0 | 1533 |  |                 _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); | 
|  | 0 | 1534 |  |                 _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); | 
|  |  | 1535 |  |             } | 
|  |  | 1536 |  |             // Set Credentials | 
|  | 0 | 1537 |  |             if (Client.Credentials != null) | 
|  |  | 1538 |  |             { | 
|  | 0 | 1539 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1540 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 1541 |  |             } | 
|  |  | 1542 |  |             // Send Request | 
|  | 0 | 1543 |  |             if (_shouldTrace) | 
|  |  | 1544 |  |             { | 
|  | 0 | 1545 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 1546 |  |             } | 
|  | 0 | 1547 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1548 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  | 0 | 1549 |  |             if (_shouldTrace) | 
|  |  | 1550 |  |             { | 
|  | 0 | 1551 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 1552 |  |             } | 
|  | 0 | 1553 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  | 0 | 1554 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1555 |  |             string _responseContent = null; | 
|  | 0 | 1556 |  |             if ((int)_statusCode != 204) | 
|  |  | 1557 |  |             { | 
|  | 0 | 1558 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 1559 |  |                 try | 
|  |  | 1560 |  |                 { | 
|  | 0 | 1561 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  | 0 | 1562 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  | 0 | 1563 |  |                     if (_errorBody != null) | 
|  |  | 1564 |  |                     { | 
|  | 0 | 1565 |  |                         ex.Body = _errorBody; | 
|  |  | 1566 |  |                     } | 
|  | 0 | 1567 |  |                 } | 
|  | 0 | 1568 |  |                 catch (JsonException) | 
|  |  | 1569 |  |                 { | 
|  |  | 1570 |  |                     // Ignore the exception | 
|  | 0 | 1571 |  |                 } | 
|  | 0 | 1572 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  | 0 | 1573 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  | 0 | 1574 |  |                 if (_shouldTrace) | 
|  |  | 1575 |  |                 { | 
|  | 0 | 1576 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 1577 |  |                 } | 
|  | 0 | 1578 |  |                 _httpRequest.Dispose(); | 
|  | 0 | 1579 |  |                 if (_httpResponse != null) | 
|  |  | 1580 |  |                 { | 
|  | 0 | 1581 |  |                     _httpResponse.Dispose(); | 
|  |  | 1582 |  |                 } | 
|  | 0 | 1583 |  |                 throw ex; | 
|  |  | 1584 |  |             } | 
|  |  | 1585 |  |             // Create Result | 
|  | 0 | 1586 |  |             var _result = new HttpOperationResponse(); | 
|  | 0 | 1587 |  |             _result.Request = _httpRequest; | 
|  | 0 | 1588 |  |             _result.Response = _httpResponse; | 
|  | 0 | 1589 |  |             if (_shouldTrace) | 
|  |  | 1590 |  |             { | 
|  | 0 | 1591 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 1592 |  |             } | 
|  | 0 | 1593 |  |             return _result; | 
|  | 0 | 1594 |  |         } | 
|  |  | 1595 |  |  | 
|  |  | 1596 |  |         /// <summary> | 
|  |  | 1597 |  |         /// This API adds a transcript file (text version of all the words spoken in a | 
|  |  | 1598 |  |         /// video) to a video review. The file should be a valid WebVTT format. | 
|  |  | 1599 |  |         /// </summary> | 
|  |  | 1600 |  |         /// <param name='teamName'> | 
|  |  | 1601 |  |         /// Your team name. | 
|  |  | 1602 |  |         /// </param> | 
|  |  | 1603 |  |         /// <param name='reviewId'> | 
|  |  | 1604 |  |         /// Id of the review. | 
|  |  | 1605 |  |         /// </param> | 
|  |  | 1606 |  |         /// <param name='vTTfile'> | 
|  |  | 1607 |  |         /// Transcript file of the video. | 
|  |  | 1608 |  |         /// </param> | 
|  |  | 1609 |  |         /// <param name='customHeaders'> | 
|  |  | 1610 |  |         /// Headers that will be added to request. | 
|  |  | 1611 |  |         /// </param> | 
|  |  | 1612 |  |         /// <param name='cancellationToken'> | 
|  |  | 1613 |  |         /// The cancellation token. | 
|  |  | 1614 |  |         /// </param> | 
|  |  | 1615 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 1616 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 1617 |  |         /// </exception> | 
|  |  | 1618 |  |         /// <exception cref="ValidationException"> | 
|  |  | 1619 |  |         /// Thrown when a required parameter is null | 
|  |  | 1620 |  |         /// </exception> | 
|  |  | 1621 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 1622 |  |         /// Thrown when a required parameter is null | 
|  |  | 1623 |  |         /// </exception> | 
|  |  | 1624 |  |         /// <return> | 
|  |  | 1625 |  |         /// A response object containing the response body and response headers. | 
|  |  | 1626 |  |         /// </return> | 
|  |  | 1627 |  |         public async Task<HttpOperationResponse> AddVideoTranscriptWithHttpMessagesAsync(string teamName, string reviewI | 
|  |  | 1628 |  |         { | 
|  | 0 | 1629 |  |             if (Client.Endpoint == null) | 
|  |  | 1630 |  |             { | 
|  | 0 | 1631 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 1632 |  |             } | 
|  | 0 | 1633 |  |             if (teamName == null) | 
|  |  | 1634 |  |             { | 
|  | 0 | 1635 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 1636 |  |             } | 
|  | 0 | 1637 |  |             if (reviewId == null) | 
|  |  | 1638 |  |             { | 
|  | 0 | 1639 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "reviewId"); | 
|  |  | 1640 |  |             } | 
|  | 0 | 1641 |  |             if (vTTfile == null) | 
|  |  | 1642 |  |             { | 
|  | 0 | 1643 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "vTTfile"); | 
|  |  | 1644 |  |             } | 
|  | 0 | 1645 |  |             string contentType = "text/plain"; | 
|  |  | 1646 |  |             // Tracing | 
|  | 0 | 1647 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  | 0 | 1648 |  |             string _invocationId = null; | 
|  | 0 | 1649 |  |             if (_shouldTrace) | 
|  |  | 1650 |  |             { | 
|  | 0 | 1651 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  | 0 | 1652 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  | 0 | 1653 |  |                 tracingParameters.Add("teamName", teamName); | 
|  | 0 | 1654 |  |                 tracingParameters.Add("reviewId", reviewId); | 
|  | 0 | 1655 |  |                 tracingParameters.Add("contentType", contentType); | 
|  | 0 | 1656 |  |                 tracingParameters.Add("vTTfile", vTTfile); | 
|  | 0 | 1657 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  | 0 | 1658 |  |                 ServiceClientTracing.Enter(_invocationId, this, "AddVideoTranscript", tracingParameters); | 
|  |  | 1659 |  |             } | 
|  |  | 1660 |  |             // Construct URL | 
|  | 0 | 1661 |  |             var _baseUrl = Client.BaseUri; | 
|  | 0 | 1662 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r | 
|  | 0 | 1663 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  | 0 | 1664 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  | 0 | 1665 |  |             _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId)); | 
|  |  | 1666 |  |             // Create HTTP transport objects | 
|  | 0 | 1667 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  | 0 | 1668 |  |             HttpResponseMessage _httpResponse = null; | 
|  | 0 | 1669 |  |             _httpRequest.Method = new HttpMethod("PUT"); | 
|  | 0 | 1670 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 1671 |  |             // Set Headers | 
|  |  | 1672 |  |  | 
|  |  | 1673 |  |  | 
|  | 0 | 1674 |  |             if (customHeaders != null) | 
|  |  | 1675 |  |             { | 
|  | 0 | 1676 |  |                 foreach(var _header in customHeaders) | 
|  |  | 1677 |  |                 { | 
|  | 0 | 1678 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 1679 |  |                     { | 
|  | 0 | 1680 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 1681 |  |                     } | 
|  | 0 | 1682 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 1683 |  |                 } | 
|  |  | 1684 |  |             } | 
|  |  | 1685 |  |  | 
|  |  | 1686 |  |             // Serialize Request | 
|  | 0 | 1687 |  |             string _requestContent = null; | 
|  | 0 | 1688 |  |             if(vTTfile == null) | 
|  |  | 1689 |  |             { | 
|  | 0 | 1690 |  |               throw new System.ArgumentNullException("vTTfile"); | 
|  |  | 1691 |  |             } | 
|  | 0 | 1692 |  |             if (vTTfile != null && vTTfile != Stream.Null) | 
|  |  | 1693 |  |             { | 
|  | 0 | 1694 |  |                 _httpRequest.Content = new StreamContent(vTTfile); | 
|  | 0 | 1695 |  |                 _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("text/plain"); | 
|  |  | 1696 |  |             } | 
|  |  | 1697 |  |             // Set Credentials | 
|  | 0 | 1698 |  |             if (Client.Credentials != null) | 
|  |  | 1699 |  |             { | 
|  | 0 | 1700 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1701 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 1702 |  |             } | 
|  |  | 1703 |  |             // Send Request | 
|  | 0 | 1704 |  |             if (_shouldTrace) | 
|  |  | 1705 |  |             { | 
|  | 0 | 1706 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 1707 |  |             } | 
|  | 0 | 1708 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1709 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  | 0 | 1710 |  |             if (_shouldTrace) | 
|  |  | 1711 |  |             { | 
|  | 0 | 1712 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 1713 |  |             } | 
|  | 0 | 1714 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  | 0 | 1715 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 1716 |  |             string _responseContent = null; | 
|  | 0 | 1717 |  |             if ((int)_statusCode != 204) | 
|  |  | 1718 |  |             { | 
|  | 0 | 1719 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 1720 |  |                 try | 
|  |  | 1721 |  |                 { | 
|  | 0 | 1722 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  | 0 | 1723 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  | 0 | 1724 |  |                     if (_errorBody != null) | 
|  |  | 1725 |  |                     { | 
|  | 0 | 1726 |  |                         ex.Body = _errorBody; | 
|  |  | 1727 |  |                     } | 
|  | 0 | 1728 |  |                 } | 
|  | 0 | 1729 |  |                 catch (JsonException) | 
|  |  | 1730 |  |                 { | 
|  |  | 1731 |  |                     // Ignore the exception | 
|  | 0 | 1732 |  |                 } | 
|  | 0 | 1733 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  | 0 | 1734 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  | 0 | 1735 |  |                 if (_shouldTrace) | 
|  |  | 1736 |  |                 { | 
|  | 0 | 1737 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 1738 |  |                 } | 
|  | 0 | 1739 |  |                 _httpRequest.Dispose(); | 
|  | 0 | 1740 |  |                 if (_httpResponse != null) | 
|  |  | 1741 |  |                 { | 
|  | 0 | 1742 |  |                     _httpResponse.Dispose(); | 
|  |  | 1743 |  |                 } | 
|  | 0 | 1744 |  |                 throw ex; | 
|  |  | 1745 |  |             } | 
|  |  | 1746 |  |             // Create Result | 
|  | 0 | 1747 |  |             var _result = new HttpOperationResponse(); | 
|  | 0 | 1748 |  |             _result.Request = _httpRequest; | 
|  | 0 | 1749 |  |             _result.Response = _httpResponse; | 
|  | 0 | 1750 |  |             if (_shouldTrace) | 
|  |  | 1751 |  |             { | 
|  | 0 | 1752 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 1753 |  |             } | 
|  | 0 | 1754 |  |             return _result; | 
|  | 0 | 1755 |  |         } | 
|  |  | 1756 |  |  | 
|  |  | 1757 |  |         /// <summary> | 
|  |  | 1758 |  |         /// The reviews created would show up for Reviewers on your team. As Reviewers | 
|  |  | 1759 |  |         /// complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) | 
|  |  | 1760 |  |         /// on the specified CallBackEndpoint. | 
|  |  | 1761 |  |         /// | 
|  |  | 1762 |  |         /// <h3>CallBack Schemas </h3> | 
|  |  | 1763 |  |         /// <h4>Review Completion CallBack Sample</h4> | 
|  |  | 1764 |  |         /// <p> | 
|  |  | 1765 |  |         /// {<br/> | 
|  |  | 1766 |  |         /// "ReviewId": "<Review Id>",<br/> | 
|  |  | 1767 |  |         /// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/> | 
|  |  | 1768 |  |         /// "ModifiedBy": "<Name of the Reviewer>",<br/> | 
|  |  | 1769 |  |         /// "CallBackType": "Review",<br/> | 
|  |  | 1770 |  |         /// "ContentId": "<The ContentId that was specified input>",<br/> | 
|  |  | 1771 |  |         /// "Metadata": {<br/> | 
|  |  | 1772 |  |         /// "adultscore": "0.xxx",<br/> | 
|  |  | 1773 |  |         /// "a": "False",<br/> | 
|  |  | 1774 |  |         /// "racyscore": "0.xxx",<br/> | 
|  |  | 1775 |  |         /// "r": "True"<br/> | 
|  |  | 1776 |  |         /// },<br/> | 
|  |  | 1777 |  |         /// "ReviewerResultTags": {<br/> | 
|  |  | 1778 |  |         /// "a": "False",<br/> | 
|  |  | 1779 |  |         /// "r": "True"<br/> | 
|  |  | 1780 |  |         /// }<br/> | 
|  |  | 1781 |  |         /// }<br/> | 
|  |  | 1782 |  |         /// | 
|  |  | 1783 |  |         /// </p>. | 
|  |  | 1784 |  |         /// </summary> | 
|  |  | 1785 |  |         /// <param name='contentType'> | 
|  |  | 1786 |  |         /// The content type. | 
|  |  | 1787 |  |         /// </param> | 
|  |  | 1788 |  |         /// <param name='teamName'> | 
|  |  | 1789 |  |         /// Your team name. | 
|  |  | 1790 |  |         /// </param> | 
|  |  | 1791 |  |         /// <param name='createVideoReviewsBody'> | 
|  |  | 1792 |  |         /// Body for create reviews API | 
|  |  | 1793 |  |         /// </param> | 
|  |  | 1794 |  |         /// <param name='subTeam'> | 
|  |  | 1795 |  |         /// SubTeam of your team, you want to assign the created review to. | 
|  |  | 1796 |  |         /// </param> | 
|  |  | 1797 |  |         /// <param name='customHeaders'> | 
|  |  | 1798 |  |         /// Headers that will be added to request. | 
|  |  | 1799 |  |         /// </param> | 
|  |  | 1800 |  |         /// <param name='cancellationToken'> | 
|  |  | 1801 |  |         /// The cancellation token. | 
|  |  | 1802 |  |         /// </param> | 
|  |  | 1803 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 1804 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 1805 |  |         /// </exception> | 
|  |  | 1806 |  |         /// <exception cref="SerializationException"> | 
|  |  | 1807 |  |         /// Thrown when unable to deserialize the response | 
|  |  | 1808 |  |         /// </exception> | 
|  |  | 1809 |  |         /// <exception cref="ValidationException"> | 
|  |  | 1810 |  |         /// Thrown when a required parameter is null | 
|  |  | 1811 |  |         /// </exception> | 
|  |  | 1812 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 1813 |  |         /// Thrown when a required parameter is null | 
|  |  | 1814 |  |         /// </exception> | 
|  |  | 1815 |  |         /// <return> | 
|  |  | 1816 |  |         /// A response object containing the response body and response headers. | 
|  |  | 1817 |  |         /// </return> | 
|  |  | 1818 |  |         public async Task<HttpOperationResponse<IList<string>>> CreateVideoReviewsWithHttpMessagesAsync(string contentTy | 
|  |  | 1819 |  |         { | 
|  | 1 | 1820 |  |             if (Client.Endpoint == null) | 
|  |  | 1821 |  |             { | 
|  | 0 | 1822 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 1823 |  |             } | 
|  | 1 | 1824 |  |             if (contentType == null) | 
|  |  | 1825 |  |             { | 
|  | 0 | 1826 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); | 
|  |  | 1827 |  |             } | 
|  | 1 | 1828 |  |             if (teamName == null) | 
|  |  | 1829 |  |             { | 
|  | 0 | 1830 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 1831 |  |             } | 
|  | 1 | 1832 |  |             if (createVideoReviewsBody == null) | 
|  |  | 1833 |  |             { | 
|  | 0 | 1834 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "createVideoReviewsBody"); | 
|  |  | 1835 |  |             } | 
|  | 1 | 1836 |  |             if (createVideoReviewsBody != null) | 
|  |  | 1837 |  |             { | 
|  | 4 | 1838 |  |                 foreach (var element in createVideoReviewsBody) | 
|  |  | 1839 |  |                 { | 
|  | 1 | 1840 |  |                     if (element != null) | 
|  |  | 1841 |  |                     { | 
|  | 1 | 1842 |  |                         element.Validate(); | 
|  |  | 1843 |  |                     } | 
|  |  | 1844 |  |                 } | 
|  |  | 1845 |  |             } | 
|  |  | 1846 |  |             // Tracing | 
|  | 1 | 1847 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  | 1 | 1848 |  |             string _invocationId = null; | 
|  | 1 | 1849 |  |             if (_shouldTrace) | 
|  |  | 1850 |  |             { | 
|  | 0 | 1851 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  | 0 | 1852 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  | 0 | 1853 |  |                 tracingParameters.Add("contentType", contentType); | 
|  | 0 | 1854 |  |                 tracingParameters.Add("teamName", teamName); | 
|  | 0 | 1855 |  |                 tracingParameters.Add("subTeam", subTeam); | 
|  | 0 | 1856 |  |                 tracingParameters.Add("createVideoReviewsBody", createVideoReviewsBody); | 
|  | 0 | 1857 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  | 0 | 1858 |  |                 ServiceClientTracing.Enter(_invocationId, this, "CreateVideoReviews", tracingParameters); | 
|  |  | 1859 |  |             } | 
|  |  | 1860 |  |             // Construct URL | 
|  | 1 | 1861 |  |             var _baseUrl = Client.BaseUri; | 
|  | 1 | 1862 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r | 
|  | 1 | 1863 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  | 1 | 1864 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  | 1 | 1865 |  |             List<string> _queryParameters = new List<string>(); | 
|  | 1 | 1866 |  |             if (subTeam != null) | 
|  |  | 1867 |  |             { | 
|  | 0 | 1868 |  |                 _queryParameters.Add(string.Format("subTeam={0}", System.Uri.EscapeDataString(subTeam))); | 
|  |  | 1869 |  |             } | 
|  | 1 | 1870 |  |             if (_queryParameters.Count > 0) | 
|  |  | 1871 |  |             { | 
|  | 0 | 1872 |  |                 _url += "?" + string.Join("&", _queryParameters); | 
|  |  | 1873 |  |             } | 
|  |  | 1874 |  |             // Create HTTP transport objects | 
|  | 1 | 1875 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  | 1 | 1876 |  |             HttpResponseMessage _httpResponse = null; | 
|  | 1 | 1877 |  |             _httpRequest.Method = new HttpMethod("POST"); | 
|  | 1 | 1878 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 1879 |  |             // Set Headers | 
|  |  | 1880 |  |  | 
|  |  | 1881 |  |  | 
|  | 1 | 1882 |  |             if (customHeaders != null) | 
|  |  | 1883 |  |             { | 
|  | 0 | 1884 |  |                 foreach(var _header in customHeaders) | 
|  |  | 1885 |  |                 { | 
|  | 0 | 1886 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 1887 |  |                     { | 
|  | 0 | 1888 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 1889 |  |                     } | 
|  | 0 | 1890 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 1891 |  |                 } | 
|  |  | 1892 |  |             } | 
|  |  | 1893 |  |  | 
|  |  | 1894 |  |             // Serialize Request | 
|  | 1 | 1895 |  |             string _requestContent = null; | 
|  | 1 | 1896 |  |             if(createVideoReviewsBody != null) | 
|  |  | 1897 |  |             { | 
|  | 1 | 1898 |  |                 _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createVideoReviewsBody, Client.Seri | 
|  | 1 | 1899 |  |                 _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); | 
|  | 1 | 1900 |  |                 _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); | 
|  |  | 1901 |  |             } | 
|  |  | 1902 |  |             // Set Credentials | 
|  | 1 | 1903 |  |             if (Client.Credentials != null) | 
|  |  | 1904 |  |             { | 
|  | 1 | 1905 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  | 1 | 1906 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 1907 |  |             } | 
|  |  | 1908 |  |             // Send Request | 
|  | 1 | 1909 |  |             if (_shouldTrace) | 
|  |  | 1910 |  |             { | 
|  | 0 | 1911 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 1912 |  |             } | 
|  | 1 | 1913 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 1 | 1914 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  | 1 | 1915 |  |             if (_shouldTrace) | 
|  |  | 1916 |  |             { | 
|  | 0 | 1917 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 1918 |  |             } | 
|  | 1 | 1919 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  | 1 | 1920 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 1 | 1921 |  |             string _responseContent = null; | 
|  | 1 | 1922 |  |             if ((int)_statusCode != 200) | 
|  |  | 1923 |  |             { | 
|  | 0 | 1924 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 1925 |  |                 try | 
|  |  | 1926 |  |                 { | 
|  | 0 | 1927 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  | 0 | 1928 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  | 0 | 1929 |  |                     if (_errorBody != null) | 
|  |  | 1930 |  |                     { | 
|  | 0 | 1931 |  |                         ex.Body = _errorBody; | 
|  |  | 1932 |  |                     } | 
|  | 0 | 1933 |  |                 } | 
|  | 0 | 1934 |  |                 catch (JsonException) | 
|  |  | 1935 |  |                 { | 
|  |  | 1936 |  |                     // Ignore the exception | 
|  | 0 | 1937 |  |                 } | 
|  | 0 | 1938 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  | 0 | 1939 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  | 0 | 1940 |  |                 if (_shouldTrace) | 
|  |  | 1941 |  |                 { | 
|  | 0 | 1942 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 1943 |  |                 } | 
|  | 0 | 1944 |  |                 _httpRequest.Dispose(); | 
|  | 0 | 1945 |  |                 if (_httpResponse != null) | 
|  |  | 1946 |  |                 { | 
|  | 0 | 1947 |  |                     _httpResponse.Dispose(); | 
|  |  | 1948 |  |                 } | 
|  | 0 | 1949 |  |                 throw ex; | 
|  |  | 1950 |  |             } | 
|  |  | 1951 |  |             // Create Result | 
|  | 1 | 1952 |  |             var _result = new HttpOperationResponse<IList<string>>(); | 
|  | 1 | 1953 |  |             _result.Request = _httpRequest; | 
|  | 1 | 1954 |  |             _result.Response = _httpResponse; | 
|  |  | 1955 |  |             // Deserialize Response | 
|  | 1 | 1956 |  |             if ((int)_statusCode == 200) | 
|  |  | 1957 |  |             { | 
|  | 1 | 1958 |  |                 _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  |  | 1959 |  |                 try | 
|  |  | 1960 |  |                 { | 
|  | 1 | 1961 |  |                     _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<IList<string>>(_responseContent, | 
|  | 1 | 1962 |  |                 } | 
|  | 0 | 1963 |  |                 catch (JsonException ex) | 
|  |  | 1964 |  |                 { | 
|  | 0 | 1965 |  |                     _httpRequest.Dispose(); | 
|  | 0 | 1966 |  |                     if (_httpResponse != null) | 
|  |  | 1967 |  |                     { | 
|  | 0 | 1968 |  |                         _httpResponse.Dispose(); | 
|  |  | 1969 |  |                     } | 
|  | 0 | 1970 |  |                     throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); | 
|  |  | 1971 |  |                 } | 
|  |  | 1972 |  |             } | 
|  | 1 | 1973 |  |             if (_shouldTrace) | 
|  |  | 1974 |  |             { | 
|  | 0 | 1975 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 1976 |  |             } | 
|  | 1 | 1977 |  |             return _result; | 
|  | 1 | 1978 |  |         } | 
|  |  | 1979 |  |  | 
|  |  | 1980 |  |         /// <summary> | 
|  |  | 1981 |  |         /// Use this method to add frames for a video review.Timescale: This parameter | 
|  |  | 1982 |  |         /// is a factor which is used to convert the timestamp on a frame into | 
|  |  | 1983 |  |         /// milliseconds. Timescale is provided in the output of the Content Moderator | 
|  |  | 1984 |  |         /// video media processor on the Azure Media Services platform.Timescale in the | 
|  |  | 1985 |  |         /// Video Moderation output is Ticks/Second. | 
|  |  | 1986 |  |         /// </summary> | 
|  |  | 1987 |  |         /// <param name='contentType'> | 
|  |  | 1988 |  |         /// The content type. | 
|  |  | 1989 |  |         /// </param> | 
|  |  | 1990 |  |         /// <param name='teamName'> | 
|  |  | 1991 |  |         /// Your team name. | 
|  |  | 1992 |  |         /// </param> | 
|  |  | 1993 |  |         /// <param name='reviewId'> | 
|  |  | 1994 |  |         /// Id of the review. | 
|  |  | 1995 |  |         /// </param> | 
|  |  | 1996 |  |         /// <param name='videoFrameBody'> | 
|  |  | 1997 |  |         /// Body for add video frames API | 
|  |  | 1998 |  |         /// </param> | 
|  |  | 1999 |  |         /// <param name='timescale'> | 
|  |  | 2000 |  |         /// Timescale of the video. | 
|  |  | 2001 |  |         /// </param> | 
|  |  | 2002 |  |         /// <param name='customHeaders'> | 
|  |  | 2003 |  |         /// Headers that will be added to request. | 
|  |  | 2004 |  |         /// </param> | 
|  |  | 2005 |  |         /// <param name='cancellationToken'> | 
|  |  | 2006 |  |         /// The cancellation token. | 
|  |  | 2007 |  |         /// </param> | 
|  |  | 2008 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 2009 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 2010 |  |         /// </exception> | 
|  |  | 2011 |  |         /// <exception cref="ValidationException"> | 
|  |  | 2012 |  |         /// Thrown when a required parameter is null | 
|  |  | 2013 |  |         /// </exception> | 
|  |  | 2014 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 2015 |  |         /// Thrown when a required parameter is null | 
|  |  | 2016 |  |         /// </exception> | 
|  |  | 2017 |  |         /// <return> | 
|  |  | 2018 |  |         /// A response object containing the response body and response headers. | 
|  |  | 2019 |  |         /// </return> | 
|  |  | 2020 |  |         public async Task<HttpOperationResponse> AddVideoFrameUrlWithHttpMessagesAsync(string contentType, string teamNa | 
|  |  | 2021 |  |         { | 
|  | 0 | 2022 |  |             if (Client.Endpoint == null) | 
|  |  | 2023 |  |             { | 
|  | 0 | 2024 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 2025 |  |             } | 
|  | 0 | 2026 |  |             if (contentType == null) | 
|  |  | 2027 |  |             { | 
|  | 0 | 2028 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); | 
|  |  | 2029 |  |             } | 
|  | 0 | 2030 |  |             if (teamName == null) | 
|  |  | 2031 |  |             { | 
|  | 0 | 2032 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 2033 |  |             } | 
|  | 0 | 2034 |  |             if (reviewId == null) | 
|  |  | 2035 |  |             { | 
|  | 0 | 2036 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "reviewId"); | 
|  |  | 2037 |  |             } | 
|  | 0 | 2038 |  |             if (videoFrameBody == null) | 
|  |  | 2039 |  |             { | 
|  | 0 | 2040 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "videoFrameBody"); | 
|  |  | 2041 |  |             } | 
|  | 0 | 2042 |  |             if (videoFrameBody != null) | 
|  |  | 2043 |  |             { | 
|  | 0 | 2044 |  |                 foreach (var element in videoFrameBody) | 
|  |  | 2045 |  |                 { | 
|  | 0 | 2046 |  |                     if (element != null) | 
|  |  | 2047 |  |                     { | 
|  | 0 | 2048 |  |                         element.Validate(); | 
|  |  | 2049 |  |                     } | 
|  |  | 2050 |  |                 } | 
|  |  | 2051 |  |             } | 
|  |  | 2052 |  |             // Tracing | 
|  | 0 | 2053 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  | 0 | 2054 |  |             string _invocationId = null; | 
|  | 0 | 2055 |  |             if (_shouldTrace) | 
|  |  | 2056 |  |             { | 
|  | 0 | 2057 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  | 0 | 2058 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  | 0 | 2059 |  |                 tracingParameters.Add("contentType", contentType); | 
|  | 0 | 2060 |  |                 tracingParameters.Add("teamName", teamName); | 
|  | 0 | 2061 |  |                 tracingParameters.Add("reviewId", reviewId); | 
|  | 0 | 2062 |  |                 tracingParameters.Add("timescale", timescale); | 
|  | 0 | 2063 |  |                 tracingParameters.Add("videoFrameBody", videoFrameBody); | 
|  | 0 | 2064 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  | 0 | 2065 |  |                 ServiceClientTracing.Enter(_invocationId, this, "AddVideoFrameUrl", tracingParameters); | 
|  |  | 2066 |  |             } | 
|  |  | 2067 |  |             // Construct URL | 
|  | 0 | 2068 |  |             var _baseUrl = Client.BaseUri; | 
|  | 0 | 2069 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r | 
|  | 0 | 2070 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  | 0 | 2071 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  | 0 | 2072 |  |             _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId)); | 
|  | 0 | 2073 |  |             List<string> _queryParameters = new List<string>(); | 
|  | 0 | 2074 |  |             if (timescale != null) | 
|  |  | 2075 |  |             { | 
|  | 0 | 2076 |  |                 _queryParameters.Add(string.Format("timescale={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJ | 
|  |  | 2077 |  |             } | 
|  | 0 | 2078 |  |             if (_queryParameters.Count > 0) | 
|  |  | 2079 |  |             { | 
|  | 0 | 2080 |  |                 _url += "?" + string.Join("&", _queryParameters); | 
|  |  | 2081 |  |             } | 
|  |  | 2082 |  |             // Create HTTP transport objects | 
|  | 0 | 2083 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  | 0 | 2084 |  |             HttpResponseMessage _httpResponse = null; | 
|  | 0 | 2085 |  |             _httpRequest.Method = new HttpMethod("POST"); | 
|  | 0 | 2086 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 2087 |  |             // Set Headers | 
|  |  | 2088 |  |  | 
|  |  | 2089 |  |  | 
|  | 0 | 2090 |  |             if (customHeaders != null) | 
|  |  | 2091 |  |             { | 
|  | 0 | 2092 |  |                 foreach(var _header in customHeaders) | 
|  |  | 2093 |  |                 { | 
|  | 0 | 2094 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 2095 |  |                     { | 
|  | 0 | 2096 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 2097 |  |                     } | 
|  | 0 | 2098 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 2099 |  |                 } | 
|  |  | 2100 |  |             } | 
|  |  | 2101 |  |  | 
|  |  | 2102 |  |             // Serialize Request | 
|  | 0 | 2103 |  |             string _requestContent = null; | 
|  | 0 | 2104 |  |             if(videoFrameBody != null) | 
|  |  | 2105 |  |             { | 
|  | 0 | 2106 |  |                 _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(videoFrameBody, Client.Serializatio | 
|  | 0 | 2107 |  |                 _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); | 
|  | 0 | 2108 |  |                 _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); | 
|  |  | 2109 |  |             } | 
|  |  | 2110 |  |             // Set Credentials | 
|  | 0 | 2111 |  |             if (Client.Credentials != null) | 
|  |  | 2112 |  |             { | 
|  | 0 | 2113 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 2114 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 2115 |  |             } | 
|  |  | 2116 |  |             // Send Request | 
|  | 0 | 2117 |  |             if (_shouldTrace) | 
|  |  | 2118 |  |             { | 
|  | 0 | 2119 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 2120 |  |             } | 
|  | 0 | 2121 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 2122 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  | 0 | 2123 |  |             if (_shouldTrace) | 
|  |  | 2124 |  |             { | 
|  | 0 | 2125 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 2126 |  |             } | 
|  | 0 | 2127 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  | 0 | 2128 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  | 0 | 2129 |  |             string _responseContent = null; | 
|  | 0 | 2130 |  |             if ((int)_statusCode != 204) | 
|  |  | 2131 |  |             { | 
|  | 0 | 2132 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 2133 |  |                 try | 
|  |  | 2134 |  |                 { | 
|  | 0 | 2135 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  | 0 | 2136 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  | 0 | 2137 |  |                     if (_errorBody != null) | 
|  |  | 2138 |  |                     { | 
|  | 0 | 2139 |  |                         ex.Body = _errorBody; | 
|  |  | 2140 |  |                     } | 
|  | 0 | 2141 |  |                 } | 
|  | 0 | 2142 |  |                 catch (JsonException) | 
|  |  | 2143 |  |                 { | 
|  |  | 2144 |  |                     // Ignore the exception | 
|  | 0 | 2145 |  |                 } | 
|  | 0 | 2146 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  | 0 | 2147 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  | 0 | 2148 |  |                 if (_shouldTrace) | 
|  |  | 2149 |  |                 { | 
|  | 0 | 2150 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 2151 |  |                 } | 
|  | 0 | 2152 |  |                 _httpRequest.Dispose(); | 
|  | 0 | 2153 |  |                 if (_httpResponse != null) | 
|  |  | 2154 |  |                 { | 
|  | 0 | 2155 |  |                     _httpResponse.Dispose(); | 
|  |  | 2156 |  |                 } | 
|  | 0 | 2157 |  |                 throw ex; | 
|  |  | 2158 |  |             } | 
|  |  | 2159 |  |             // Create Result | 
|  | 0 | 2160 |  |             var _result = new HttpOperationResponse(); | 
|  | 0 | 2161 |  |             _result.Request = _httpRequest; | 
|  | 0 | 2162 |  |             _result.Response = _httpResponse; | 
|  | 0 | 2163 |  |             if (_shouldTrace) | 
|  |  | 2164 |  |             { | 
|  | 0 | 2165 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 2166 |  |             } | 
|  | 0 | 2167 |  |             return _result; | 
|  | 0 | 2168 |  |         } | 
|  |  | 2169 |  |  | 
|  |  | 2170 |  |         /// <summary> | 
|  |  | 2171 |  |         /// Use this method to add frames for a video review.Timescale: This parameter | 
|  |  | 2172 |  |         /// is a factor which is used to convert the timestamp on a frame into | 
|  |  | 2173 |  |         /// milliseconds. Timescale is provided in the output of the Content Moderator | 
|  |  | 2174 |  |         /// video media processor on the Azure Media Services platform.Timescale in the | 
|  |  | 2175 |  |         /// Video Moderation output is Ticks/Second. | 
|  |  | 2176 |  |         /// </summary> | 
|  |  | 2177 |  |         /// <param name='contentType'> | 
|  |  | 2178 |  |         /// The content type. | 
|  |  | 2179 |  |         /// </param> | 
|  |  | 2180 |  |         /// <param name='teamName'> | 
|  |  | 2181 |  |         /// Your team name. | 
|  |  | 2182 |  |         /// </param> | 
|  |  | 2183 |  |         /// <param name='reviewId'> | 
|  |  | 2184 |  |         /// Id of the review. | 
|  |  | 2185 |  |         /// </param> | 
|  |  | 2186 |  |         /// <param name='frameImageZip'> | 
|  |  | 2187 |  |         /// Zip file containing frame images. | 
|  |  | 2188 |  |         /// </param> | 
|  |  | 2189 |  |         /// <param name='frameMetadata'> | 
|  |  | 2190 |  |         /// Metadata of the frame. | 
|  |  | 2191 |  |         /// </param> | 
|  |  | 2192 |  |         /// <param name='timescale'> | 
|  |  | 2193 |  |         /// Timescale of the video . | 
|  |  | 2194 |  |         /// </param> | 
|  |  | 2195 |  |         /// <param name='customHeaders'> | 
|  |  | 2196 |  |         /// Headers that will be added to request. | 
|  |  | 2197 |  |         /// </param> | 
|  |  | 2198 |  |         /// <param name='cancellationToken'> | 
|  |  | 2199 |  |         /// The cancellation token. | 
|  |  | 2200 |  |         /// </param> | 
|  |  | 2201 |  |         /// <exception cref="APIErrorException"> | 
|  |  | 2202 |  |         /// Thrown when the operation returned an invalid status code | 
|  |  | 2203 |  |         /// </exception> | 
|  |  | 2204 |  |         /// <exception cref="ValidationException"> | 
|  |  | 2205 |  |         /// Thrown when a required parameter is null | 
|  |  | 2206 |  |         /// </exception> | 
|  |  | 2207 |  |         /// <exception cref="System.ArgumentNullException"> | 
|  |  | 2208 |  |         /// Thrown when a required parameter is null | 
|  |  | 2209 |  |         /// </exception> | 
|  |  | 2210 |  |         /// <return> | 
|  |  | 2211 |  |         /// A response object containing the response body and response headers. | 
|  |  | 2212 |  |         /// </return> | 
|  |  | 2213 |  |         public async Task<HttpOperationResponse> AddVideoFrameStreamWithHttpMessagesAsync(string contentType, string tea | 
|  |  | 2214 |  |         { | 
|  |  | 2215 |  |             if (Client.Endpoint == null) | 
|  |  | 2216 |  |             { | 
|  |  | 2217 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); | 
|  |  | 2218 |  |             } | 
|  |  | 2219 |  |             if (contentType == null) | 
|  |  | 2220 |  |             { | 
|  |  | 2221 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "contentType"); | 
|  |  | 2222 |  |             } | 
|  |  | 2223 |  |             if (teamName == null) | 
|  |  | 2224 |  |             { | 
|  |  | 2225 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "teamName"); | 
|  |  | 2226 |  |             } | 
|  |  | 2227 |  |             if (reviewId == null) | 
|  |  | 2228 |  |             { | 
|  |  | 2229 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "reviewId"); | 
|  |  | 2230 |  |             } | 
|  |  | 2231 |  |             if (frameImageZip == null) | 
|  |  | 2232 |  |             { | 
|  |  | 2233 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "frameImageZip"); | 
|  |  | 2234 |  |             } | 
|  |  | 2235 |  |             if (frameMetadata == null) | 
|  |  | 2236 |  |             { | 
|  |  | 2237 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "frameMetadata"); | 
|  |  | 2238 |  |             } | 
|  |  | 2239 |  |             // Tracing | 
|  |  | 2240 |  |             bool _shouldTrace = ServiceClientTracing.IsEnabled; | 
|  |  | 2241 |  |             string _invocationId = null; | 
|  |  | 2242 |  |             if (_shouldTrace) | 
|  |  | 2243 |  |             { | 
|  |  | 2244 |  |                 _invocationId = ServiceClientTracing.NextInvocationId.ToString(); | 
|  |  | 2245 |  |                 Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); | 
|  |  | 2246 |  |                 tracingParameters.Add("contentType", contentType); | 
|  |  | 2247 |  |                 tracingParameters.Add("teamName", teamName); | 
|  |  | 2248 |  |                 tracingParameters.Add("reviewId", reviewId); | 
|  |  | 2249 |  |                 tracingParameters.Add("timescale", timescale); | 
|  |  | 2250 |  |                 tracingParameters.Add("frameImageZip", frameImageZip); | 
|  |  | 2251 |  |                 tracingParameters.Add("frameMetadata", frameMetadata); | 
|  |  | 2252 |  |                 tracingParameters.Add("cancellationToken", cancellationToken); | 
|  |  | 2253 |  |                 ServiceClientTracing.Enter(_invocationId, this, "AddVideoFrameStream", tracingParameters); | 
|  |  | 2254 |  |             } | 
|  |  | 2255 |  |             // Construct URL | 
|  |  | 2256 |  |             var _baseUrl = Client.BaseUri; | 
|  |  | 2257 |  |             var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r | 
|  |  | 2258 |  |             _url = _url.Replace("{Endpoint}", Client.Endpoint); | 
|  |  | 2259 |  |             _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName)); | 
|  |  | 2260 |  |             _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId)); | 
|  |  | 2261 |  |             List<string> _queryParameters = new List<string>(); | 
|  |  | 2262 |  |             if (timescale != null) | 
|  |  | 2263 |  |             { | 
|  |  | 2264 |  |                 _queryParameters.Add(string.Format("timescale={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJ | 
|  |  | 2265 |  |             } | 
|  |  | 2266 |  |             if (_queryParameters.Count > 0) | 
|  |  | 2267 |  |             { | 
|  |  | 2268 |  |                 _url += "?" + string.Join("&", _queryParameters); | 
|  |  | 2269 |  |             } | 
|  |  | 2270 |  |             // Create HTTP transport objects | 
|  |  | 2271 |  |             var _httpRequest = new HttpRequestMessage(); | 
|  |  | 2272 |  |             HttpResponseMessage _httpResponse = null; | 
|  |  | 2273 |  |             _httpRequest.Method = new HttpMethod("POST"); | 
|  |  | 2274 |  |             _httpRequest.RequestUri = new System.Uri(_url); | 
|  |  | 2275 |  |             // Set Headers | 
|  |  | 2276 |  |  | 
|  |  | 2277 |  |  | 
|  |  | 2278 |  |             if (customHeaders != null) | 
|  |  | 2279 |  |             { | 
|  |  | 2280 |  |                 foreach(var _header in customHeaders) | 
|  |  | 2281 |  |                 { | 
|  |  | 2282 |  |                     if (_httpRequest.Headers.Contains(_header.Key)) | 
|  |  | 2283 |  |                     { | 
|  |  | 2284 |  |                         _httpRequest.Headers.Remove(_header.Key); | 
|  |  | 2285 |  |                     } | 
|  |  | 2286 |  |                     _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); | 
|  |  | 2287 |  |                 } | 
|  |  | 2288 |  |             } | 
|  |  | 2289 |  |  | 
|  |  | 2290 |  |             // Serialize Request | 
|  |  | 2291 |  |             string _requestContent = null; | 
|  |  | 2292 |  |             MultipartFormDataContent _multiPartContent = new MultipartFormDataContent(); | 
|  |  | 2293 |  |             if (frameImageZip != null) | 
|  |  | 2294 |  |             { | 
|  |  | 2295 |  |                 StreamContent _frameImageZip = new StreamContent(frameImageZip); | 
|  |  | 2296 |  |                 _frameImageZip.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); | 
|  |  | 2297 |  |                 ContentDispositionHeaderValue _contentDispositionHeaderValue = new ContentDispositionHeaderValue("form-d | 
|  |  | 2298 |  |                 _contentDispositionHeaderValue.Name = "frameImageZip"; | 
|  |  | 2299 |  |                 // get filename from stream if it's a file otherwise, just use  'unknown' | 
|  |  | 2300 |  |                 var _fileStream = frameImageZip as FileStream; | 
|  |  | 2301 |  |                 var _fileName = (_fileStream != null ? _fileStream.Name : null) ?? "unknown"; | 
|  | 0 | 2302 |  |                 if(System.Linq.Enumerable.Any(_fileName, c => c > 127) ) | 
|  |  | 2303 |  |                 { | 
|  |  | 2304 |  |                     // non ASCII chars detected, need UTF encoding: | 
|  |  | 2305 |  |                     _contentDispositionHeaderValue.FileNameStar = _fileName; | 
|  |  | 2306 |  |                 } | 
|  |  | 2307 |  |                 else | 
|  |  | 2308 |  |                 { | 
|  |  | 2309 |  |                     // ASCII only | 
|  |  | 2310 |  |                     _contentDispositionHeaderValue.FileName = _fileName; | 
|  |  | 2311 |  |                 } | 
|  |  | 2312 |  |                 _frameImageZip.Headers.ContentDisposition = _contentDispositionHeaderValue; | 
|  |  | 2313 |  |                 _multiPartContent.Add(_frameImageZip, "frameImageZip"); | 
|  |  | 2314 |  |             } | 
|  |  | 2315 |  |             if (frameMetadata != null) | 
|  |  | 2316 |  |             { | 
|  |  | 2317 |  |                 StringContent _frameMetadata = new StringContent(frameMetadata, System.Text.Encoding.UTF8); | 
|  |  | 2318 |  |                 _multiPartContent.Add(_frameMetadata, "frameMetadata"); | 
|  |  | 2319 |  |             } | 
|  |  | 2320 |  |             _httpRequest.Content = _multiPartContent; | 
|  |  | 2321 |  |             // Set Credentials | 
|  |  | 2322 |  |             if (Client.Credentials != null) | 
|  |  | 2323 |  |             { | 
|  |  | 2324 |  |                 cancellationToken.ThrowIfCancellationRequested(); | 
|  |  | 2325 |  |                 await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 2326 |  |             } | 
|  |  | 2327 |  |             // Send Request | 
|  |  | 2328 |  |             if (_shouldTrace) | 
|  |  | 2329 |  |             { | 
|  |  | 2330 |  |                 ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | 
|  |  | 2331 |  |             } | 
|  |  | 2332 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  |  | 2333 |  |             _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | 
|  |  | 2334 |  |             if (_shouldTrace) | 
|  |  | 2335 |  |             { | 
|  |  | 2336 |  |                 ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | 
|  |  | 2337 |  |             } | 
|  |  | 2338 |  |             HttpStatusCode _statusCode = _httpResponse.StatusCode; | 
|  |  | 2339 |  |             cancellationToken.ThrowIfCancellationRequested(); | 
|  |  | 2340 |  |             string _responseContent = null; | 
|  |  | 2341 |  |             if ((int)_statusCode != 204) | 
|  |  | 2342 |  |             { | 
|  |  | 2343 |  |                 var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC | 
|  |  | 2344 |  |                 try | 
|  |  | 2345 |  |                 { | 
|  |  | 2346 |  |                     _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | 
|  |  | 2347 |  |                     APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte | 
|  |  | 2348 |  |                     if (_errorBody != null) | 
|  |  | 2349 |  |                     { | 
|  |  | 2350 |  |                         ex.Body = _errorBody; | 
|  |  | 2351 |  |                     } | 
|  |  | 2352 |  |                 } | 
|  |  | 2353 |  |                 catch (JsonException) | 
|  |  | 2354 |  |                 { | 
|  |  | 2355 |  |                     // Ignore the exception | 
|  |  | 2356 |  |                 } | 
|  |  | 2357 |  |                 ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); | 
|  |  | 2358 |  |                 ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); | 
|  |  | 2359 |  |                 if (_shouldTrace) | 
|  |  | 2360 |  |                 { | 
|  |  | 2361 |  |                     ServiceClientTracing.Error(_invocationId, ex); | 
|  |  | 2362 |  |                 } | 
|  |  | 2363 |  |                 _httpRequest.Dispose(); | 
|  |  | 2364 |  |                 if (_httpResponse != null) | 
|  |  | 2365 |  |                 { | 
|  |  | 2366 |  |                     _httpResponse.Dispose(); | 
|  |  | 2367 |  |                 } | 
|  |  | 2368 |  |                 throw ex; | 
|  |  | 2369 |  |             } | 
|  |  | 2370 |  |             // Create Result | 
|  |  | 2371 |  |             var _result = new HttpOperationResponse(); | 
|  |  | 2372 |  |             _result.Request = _httpRequest; | 
|  |  | 2373 |  |             _result.Response = _httpResponse; | 
|  |  | 2374 |  |             if (_shouldTrace) | 
|  |  | 2375 |  |             { | 
|  |  | 2376 |  |                 ServiceClientTracing.Exit(_invocationId, _result); | 
|  |  | 2377 |  |             } | 
|  |  | 2378 |  |             return _result; | 
|  |  | 2379 |  |         } | 
|  |  | 2380 |  |  | 
|  |  | 2381 |  |     } | 
|  |  | 2382 |  | } |