< Summary

Class:Microsoft.Azure.CognitiveServices.ContentModerator.Reviews
Assembly:Microsoft.Azure.CognitiveServices.Vision.ContentModerator
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.ContentModerator\src\Generated\Reviews.cs
Covered lines:201
Uncovered lines:713
Coverable lines:914
Total lines:2382
Line coverage:21.9% (201 of 914)
Covered branches:99
Total branches:482
Branch coverage:20.5% (99 of 482)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
get_Client()-100%100%
GetReviewWithHttpMessagesAsync()-50.67%38.89%
GetJobDetailsWithHttpMessagesAsync()-0%0%
CreateReviewsWithHttpMessagesAsync()-54.74%51.85%
CreateJobWithHttpMessagesAsync()-54.81%53.45%
AddVideoFrameWithHttpMessagesAsync()-0%0%
GetVideoFramesWithHttpMessagesAsync()-0%0%
PublishVideoReviewWithHttpMessagesAsync()-0%0%
AddVideoTranscriptModerationResultWithHttpMessagesAsync()-0%0%
AddVideoTranscriptWithHttpMessagesAsync()-0%0%
CreateVideoReviewsWithHttpMessagesAsync()-53.85%50%
AddVideoFrameUrlWithHttpMessagesAsync()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.ContentModerator\src\Generated\Reviews.cs

#LineLine coverage
 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
 7namespace 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>
 536        public Reviews(ContentModeratorClient client)
 37        {
 538            if (client == null)
 39            {
 040                throw new System.ArgumentNullException("client");
 41            }
 542            Client = client;
 543        }
 44
 45        /// <summary>
 46        /// Gets a reference to the ContentModeratorClient
 47        /// </summary>
 4448        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        {
 282            if (Client.Endpoint == null)
 83            {
 084                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint");
 85            }
 286            if (teamName == null)
 87            {
 088                throw new ValidationException(ValidationRules.CannotBeNull, "teamName");
 89            }
 290            if (reviewId == null)
 91            {
 092                throw new ValidationException(ValidationRules.CannotBeNull, "reviewId");
 93            }
 94            // Tracing
 295            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 296            string _invocationId = null;
 297            if (_shouldTrace)
 98            {
 099                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0100                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0101                tracingParameters.Add("teamName", teamName);
 0102                tracingParameters.Add("reviewId", reviewId);
 0103                tracingParameters.Add("cancellationToken", cancellationToken);
 0104                ServiceClientTracing.Enter(_invocationId, this, "GetReview", tracingParameters);
 105            }
 106            // Construct URL
 2107            var _baseUrl = Client.BaseUri;
 2108            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r
 2109            _url = _url.Replace("{Endpoint}", Client.Endpoint);
 2110            _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName));
 2111            _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId));
 112            // Create HTTP transport objects
 2113            var _httpRequest = new HttpRequestMessage();
 2114            HttpResponseMessage _httpResponse = null;
 2115            _httpRequest.Method = new HttpMethod("GET");
 2116            _httpRequest.RequestUri = new System.Uri(_url);
 117            // Set Headers
 118
 119
 2120            if (customHeaders != null)
 121            {
 0122                foreach(var _header in customHeaders)
 123                {
 0124                    if (_httpRequest.Headers.Contains(_header.Key))
 125                    {
 0126                        _httpRequest.Headers.Remove(_header.Key);
 127                    }
 0128                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 129                }
 130            }
 131
 132            // Serialize Request
 2133            string _requestContent = null;
 134            // Set Credentials
 2135            if (Client.Credentials != null)
 136            {
 2137                cancellationToken.ThrowIfCancellationRequested();
 2138                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 139            }
 140            // Send Request
 2141            if (_shouldTrace)
 142            {
 0143                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 144            }
 2145            cancellationToken.ThrowIfCancellationRequested();
 2146            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 2147            if (_shouldTrace)
 148            {
 0149                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 150            }
 2151            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 2152            cancellationToken.ThrowIfCancellationRequested();
 2153            string _responseContent = null;
 2154            if ((int)_statusCode != 200)
 155            {
 0156                var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC
 157                try
 158                {
 0159                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0160                    APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte
 0161                    if (_errorBody != null)
 162                    {
 0163                        ex.Body = _errorBody;
 164                    }
 0165                }
 0166                catch (JsonException)
 167                {
 168                    // Ignore the exception
 0169                }
 0170                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0171                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0172                if (_shouldTrace)
 173                {
 0174                    ServiceClientTracing.Error(_invocationId, ex);
 175                }
 0176                _httpRequest.Dispose();
 0177                if (_httpResponse != null)
 178                {
 0179                    _httpResponse.Dispose();
 180                }
 0181                throw ex;
 182            }
 183            // Create Result
 2184            var _result = new HttpOperationResponse<Review>();
 2185            _result.Request = _httpRequest;
 2186            _result.Response = _httpResponse;
 187            // Deserialize Response
 2188            if ((int)_statusCode == 200)
 189            {
 2190                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 191                try
 192                {
 2193                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Review>(_responseContent, Client
 2194                }
 0195                catch (JsonException ex)
 196                {
 0197                    _httpRequest.Dispose();
 0198                    if (_httpResponse != null)
 199                    {
 0200                        _httpResponse.Dispose();
 201                    }
 0202                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 203                }
 204            }
 2205            if (_shouldTrace)
 206            {
 0207                ServiceClientTracing.Exit(_invocationId, _result);
 208            }
 2209            return _result;
 2210        }
 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        {
 0244            if (Client.Endpoint == null)
 245            {
 0246                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint");
 247            }
 0248            if (teamName == null)
 249            {
 0250                throw new ValidationException(ValidationRules.CannotBeNull, "teamName");
 251            }
 0252            if (jobId == null)
 253            {
 0254                throw new ValidationException(ValidationRules.CannotBeNull, "jobId");
 255            }
 256            // Tracing
 0257            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 0258            string _invocationId = null;
 0259            if (_shouldTrace)
 260            {
 0261                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0262                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0263                tracingParameters.Add("teamName", teamName);
 0264                tracingParameters.Add("jobId", jobId);
 0265                tracingParameters.Add("cancellationToken", cancellationToken);
 0266                ServiceClientTracing.Enter(_invocationId, this, "GetJobDetails", tracingParameters);
 267            }
 268            // Construct URL
 0269            var _baseUrl = Client.BaseUri;
 0270            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/j
 0271            _url = _url.Replace("{Endpoint}", Client.Endpoint);
 0272            _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName));
 0273            _url = _url.Replace("{JobId}", System.Uri.EscapeDataString(jobId));
 274            // Create HTTP transport objects
 0275            var _httpRequest = new HttpRequestMessage();
 0276            HttpResponseMessage _httpResponse = null;
 0277            _httpRequest.Method = new HttpMethod("GET");
 0278            _httpRequest.RequestUri = new System.Uri(_url);
 279            // Set Headers
 280
 281
 0282            if (customHeaders != null)
 283            {
 0284                foreach(var _header in customHeaders)
 285                {
 0286                    if (_httpRequest.Headers.Contains(_header.Key))
 287                    {
 0288                        _httpRequest.Headers.Remove(_header.Key);
 289                    }
 0290                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 291                }
 292            }
 293
 294            // Serialize Request
 0295            string _requestContent = null;
 296            // Set Credentials
 0297            if (Client.Credentials != null)
 298            {
 0299                cancellationToken.ThrowIfCancellationRequested();
 0300                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 301            }
 302            // Send Request
 0303            if (_shouldTrace)
 304            {
 0305                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 306            }
 0307            cancellationToken.ThrowIfCancellationRequested();
 0308            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 0309            if (_shouldTrace)
 310            {
 0311                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 312            }
 0313            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 0314            cancellationToken.ThrowIfCancellationRequested();
 0315            string _responseContent = null;
 0316            if ((int)_statusCode != 200)
 317            {
 0318                var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC
 319                try
 320                {
 0321                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0322                    APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte
 0323                    if (_errorBody != null)
 324                    {
 0325                        ex.Body = _errorBody;
 326                    }
 0327                }
 0328                catch (JsonException)
 329                {
 330                    // Ignore the exception
 0331                }
 0332                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0333                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0334                if (_shouldTrace)
 335                {
 0336                    ServiceClientTracing.Error(_invocationId, ex);
 337                }
 0338                _httpRequest.Dispose();
 0339                if (_httpResponse != null)
 340                {
 0341                    _httpResponse.Dispose();
 342                }
 0343                throw ex;
 344            }
 345            // Create Result
 0346            var _result = new HttpOperationResponse<Job>();
 0347            _result.Request = _httpRequest;
 0348            _result.Response = _httpResponse;
 349            // Deserialize Response
 0350            if ((int)_statusCode == 200)
 351            {
 0352                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 353                try
 354                {
 0355                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Job>(_responseContent, Client.De
 0356                }
 0357                catch (JsonException ex)
 358                {
 0359                    _httpRequest.Dispose();
 0360                    if (_httpResponse != null)
 361                    {
 0362                        _httpResponse.Dispose();
 363                    }
 0364                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 365                }
 366            }
 0367            if (_shouldTrace)
 368            {
 0369                ServiceClientTracing.Exit(_invocationId, _result);
 370            }
 0371            return _result;
 0372        }
 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        /// &lt;h3&gt;CallBack Schemas &lt;/h3&gt;
 380        /// &lt;h4&gt;Review Completion CallBack Sample&lt;/h4&gt;
 381        /// &lt;p&gt;
 382        /// {&lt;br/&gt;
 383        /// "ReviewId": "&lt;Review Id&gt;",&lt;br/&gt;
 384        /// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",&lt;br/&gt;
 385        /// "ModifiedBy": "&lt;Name of the Reviewer&gt;",&lt;br/&gt;
 386        /// "CallBackType": "Review",&lt;br/&gt;
 387        /// "ContentId": "&lt;The ContentId that was specified input&gt;",&lt;br/&gt;
 388        /// "Metadata": {&lt;br/&gt;
 389        /// "adultscore": "0.xxx",&lt;br/&gt;
 390        /// "a": "False",&lt;br/&gt;
 391        /// "racyscore": "0.xxx",&lt;br/&gt;
 392        /// "r": "True"&lt;br/&gt;
 393        /// },&lt;br/&gt;
 394        /// "ReviewerResultTags": {&lt;br/&gt;
 395        /// "a": "False",&lt;br/&gt;
 396        /// "r": "True"&lt;br/&gt;
 397        /// }&lt;br/&gt;
 398        /// }&lt;br/&gt;
 399        ///
 400        /// &lt;/p&gt;.
 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        {
 1437            if (Client.Endpoint == null)
 438            {
 0439                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint");
 440            }
 1441            if (urlContentType == null)
 442            {
 0443                throw new ValidationException(ValidationRules.CannotBeNull, "urlContentType");
 444            }
 1445            if (teamName == null)
 446            {
 0447                throw new ValidationException(ValidationRules.CannotBeNull, "teamName");
 448            }
 1449            if (createReviewBody == null)
 450            {
 0451                throw new ValidationException(ValidationRules.CannotBeNull, "createReviewBody");
 452            }
 1453            if (createReviewBody != null)
 454            {
 4455                foreach (var element in createReviewBody)
 456                {
 1457                    if (element != null)
 458                    {
 1459                        element.Validate();
 460                    }
 461                }
 462            }
 463            // Tracing
 1464            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 1465            string _invocationId = null;
 1466            if (_shouldTrace)
 467            {
 0468                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0469                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0470                tracingParameters.Add("urlContentType", urlContentType);
 0471                tracingParameters.Add("teamName", teamName);
 0472                tracingParameters.Add("subTeam", subTeam);
 0473                tracingParameters.Add("createReviewBody", createReviewBody);
 0474                tracingParameters.Add("cancellationToken", cancellationToken);
 0475                ServiceClientTracing.Enter(_invocationId, this, "CreateReviews", tracingParameters);
 476            }
 477            // Construct URL
 1478            var _baseUrl = Client.BaseUri;
 1479            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r
 1480            _url = _url.Replace("{Endpoint}", Client.Endpoint);
 1481            _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName));
 1482            List<string> _queryParameters = new List<string>();
 1483            if (subTeam != null)
 484            {
 0485                _queryParameters.Add(string.Format("subTeam={0}", System.Uri.EscapeDataString(subTeam)));
 486            }
 1487            if (_queryParameters.Count > 0)
 488            {
 0489                _url += "?" + string.Join("&", _queryParameters);
 490            }
 491            // Create HTTP transport objects
 1492            var _httpRequest = new HttpRequestMessage();
 1493            HttpResponseMessage _httpResponse = null;
 1494            _httpRequest.Method = new HttpMethod("POST");
 1495            _httpRequest.RequestUri = new System.Uri(_url);
 496            // Set Headers
 1497            if (urlContentType != null)
 498            {
 1499                if (_httpRequest.Headers.Contains("UrlContentType"))
 500                {
 0501                    _httpRequest.Headers.Remove("UrlContentType");
 502                }
 1503                _httpRequest.Headers.TryAddWithoutValidation("UrlContentType", urlContentType);
 504            }
 505
 506
 1507            if (customHeaders != null)
 508            {
 0509                foreach(var _header in customHeaders)
 510                {
 0511                    if (_httpRequest.Headers.Contains(_header.Key))
 512                    {
 0513                        _httpRequest.Headers.Remove(_header.Key);
 514                    }
 0515                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 516                }
 517            }
 518
 519            // Serialize Request
 1520            string _requestContent = null;
 1521            if(createReviewBody != null)
 522            {
 1523                _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createReviewBody, Client.Serializat
 1524                _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
 1525                _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
 526            }
 527            // Set Credentials
 1528            if (Client.Credentials != null)
 529            {
 1530                cancellationToken.ThrowIfCancellationRequested();
 1531                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 532            }
 533            // Send Request
 1534            if (_shouldTrace)
 535            {
 0536                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 537            }
 1538            cancellationToken.ThrowIfCancellationRequested();
 1539            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 1540            if (_shouldTrace)
 541            {
 0542                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 543            }
 1544            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 1545            cancellationToken.ThrowIfCancellationRequested();
 1546            string _responseContent = null;
 1547            if ((int)_statusCode != 200)
 548            {
 0549                var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC
 550                try
 551                {
 0552                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0553                    APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte
 0554                    if (_errorBody != null)
 555                    {
 0556                        ex.Body = _errorBody;
 557                    }
 0558                }
 0559                catch (JsonException)
 560                {
 561                    // Ignore the exception
 0562                }
 0563                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0564                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0565                if (_shouldTrace)
 566                {
 0567                    ServiceClientTracing.Error(_invocationId, ex);
 568                }
 0569                _httpRequest.Dispose();
 0570                if (_httpResponse != null)
 571                {
 0572                    _httpResponse.Dispose();
 573                }
 0574                throw ex;
 575            }
 576            // Create Result
 1577            var _result = new HttpOperationResponse<IList<string>>();
 1578            _result.Request = _httpRequest;
 1579            _result.Response = _httpResponse;
 580            // Deserialize Response
 1581            if ((int)_statusCode == 200)
 582            {
 1583                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 584                try
 585                {
 1586                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<IList<string>>(_responseContent,
 1587                }
 0588                catch (JsonException ex)
 589                {
 0590                    _httpRequest.Dispose();
 0591                    if (_httpResponse != null)
 592                    {
 0593                        _httpResponse.Dispose();
 594                    }
 0595                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 596                }
 597            }
 1598            if (_shouldTrace)
 599            {
 0600                ServiceClientTracing.Exit(_invocationId, _result);
 601            }
 1602            return _result;
 1603        }
 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        /// &lt;h3&gt;CallBack Schemas &lt;/h3&gt;
 612        ///
 613        /// &lt;p&gt;
 614        /// &lt;h4&gt;Job Completion CallBack Sample&lt;/h4&gt;&lt;br/&gt;
 615        ///
 616        /// {&lt;br/&gt;
 617        /// "JobId": "&lt;Job Id&gt;,&lt;br/&gt;
 618        /// "ReviewId": "&lt;Review Id, if the Job resulted in a Review to be
 619        /// created&gt;",&lt;br/&gt;
 620        /// "WorkFlowId": "default",&lt;br/&gt;
 621        /// "Status": "&lt;This will be one of Complete, InProgress,
 622        /// Error&gt;",&lt;br/&gt;
 623        /// "ContentType": "Image",&lt;br/&gt;
 624        /// "ContentId": "&lt;This is the ContentId that was specified on
 625        /// input&gt;",&lt;br/&gt;
 626        /// "CallBackType": "Job",&lt;br/&gt;
 627        /// "Metadata": {&lt;br/&gt;
 628        /// "adultscore": "0.xxx",&lt;br/&gt;
 629        /// "a": "False",&lt;br/&gt;
 630        /// "racyscore": "0.xxx",&lt;br/&gt;
 631        /// "r": "True"&lt;br/&gt;
 632        /// }&lt;br/&gt;
 633        /// }&lt;br/&gt;
 634        ///
 635        /// &lt;/p&gt;
 636        /// &lt;p&gt;
 637        /// &lt;h4&gt;Review Completion CallBack Sample&lt;/h4&gt;&lt;br/&gt;
 638        ///
 639        /// {
 640        /// "ReviewId": "&lt;Review Id&gt;",&lt;br/&gt;
 641        /// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",&lt;br/&gt;
 642        /// "ModifiedBy": "&lt;Name of the Reviewer&gt;",&lt;br/&gt;
 643        /// "CallBackType": "Review",&lt;br/&gt;
 644        /// "ContentId": "&lt;The ContentId that was specified input&gt;",&lt;br/&gt;
 645        /// "Metadata": {&lt;br/&gt;
 646        /// "adultscore": "0.xxx",
 647        /// "a": "False",&lt;br/&gt;
 648        /// "racyscore": "0.xxx",&lt;br/&gt;
 649        /// "r": "True"&lt;br/&gt;
 650        /// },&lt;br/&gt;
 651        /// "ReviewerResultTags": {&lt;br/&gt;
 652        /// "a": "False",&lt;br/&gt;
 653        /// "r": "True"&lt;br/&gt;
 654        /// }&lt;br/&gt;
 655        /// }&lt;br/&gt;
 656        ///
 657        /// &lt;/p&gt;.
 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        {
 1703            if (Client.Endpoint == null)
 704            {
 0705                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint");
 706            }
 1707            if (teamName == null)
 708            {
 0709                throw new ValidationException(ValidationRules.CannotBeNull, "teamName");
 710            }
 1711            if (contentType == null)
 712            {
 0713                throw new ValidationException(ValidationRules.CannotBeNull, "contentType");
 714            }
 1715            if (contentId == null)
 716            {
 0717                throw new ValidationException(ValidationRules.CannotBeNull, "contentId");
 718            }
 1719            if (workflowName == null)
 720            {
 0721                throw new ValidationException(ValidationRules.CannotBeNull, "workflowName");
 722            }
 1723            if (jobContentType == null)
 724            {
 0725                throw new ValidationException(ValidationRules.CannotBeNull, "jobContentType");
 726            }
 1727            if (content == null)
 728            {
 0729                throw new ValidationException(ValidationRules.CannotBeNull, "content");
 730            }
 1731            if (content != null)
 732            {
 1733                content.Validate();
 734            }
 735            // Tracing
 1736            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 1737            string _invocationId = null;
 1738            if (_shouldTrace)
 739            {
 0740                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0741                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0742                tracingParameters.Add("teamName", teamName);
 0743                tracingParameters.Add("contentType", contentType);
 0744                tracingParameters.Add("contentId", contentId);
 0745                tracingParameters.Add("workflowName", workflowName);
 0746                tracingParameters.Add("callBackEndpoint", callBackEndpoint);
 0747                tracingParameters.Add("jobContentType", jobContentType);
 0748                tracingParameters.Add("content", content);
 0749                tracingParameters.Add("cancellationToken", cancellationToken);
 0750                ServiceClientTracing.Enter(_invocationId, this, "CreateJob", tracingParameters);
 751            }
 752            // Construct URL
 1753            var _baseUrl = Client.BaseUri;
 1754            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/j
 1755            _url = _url.Replace("{Endpoint}", Client.Endpoint);
 1756            _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName));
 1757            List<string> _queryParameters = new List<string>();
 1758            if (contentType != null)
 759            {
 1760                _queryParameters.Add(string.Format("ContentType={0}", System.Uri.EscapeDataString(Rest.Serialization.Saf
 761            }
 1762            if (contentId != null)
 763            {
 1764                _queryParameters.Add(string.Format("ContentId={0}", System.Uri.EscapeDataString(contentId)));
 765            }
 1766            if (workflowName != null)
 767            {
 1768                _queryParameters.Add(string.Format("WorkflowName={0}", System.Uri.EscapeDataString(workflowName)));
 769            }
 1770            if (callBackEndpoint != null)
 771            {
 0772                _queryParameters.Add(string.Format("CallBackEndpoint={0}", System.Uri.EscapeDataString(callBackEndpoint)
 773            }
 1774            if (_queryParameters.Count > 0)
 775            {
 1776                _url += "?" + string.Join("&", _queryParameters);
 777            }
 778            // Create HTTP transport objects
 1779            var _httpRequest = new HttpRequestMessage();
 1780            HttpResponseMessage _httpResponse = null;
 1781            _httpRequest.Method = new HttpMethod("POST");
 1782            _httpRequest.RequestUri = new System.Uri(_url);
 783            // Set Headers
 784
 785
 1786            if (customHeaders != null)
 787            {
 0788                foreach(var _header in customHeaders)
 789                {
 0790                    if (_httpRequest.Headers.Contains(_header.Key))
 791                    {
 0792                        _httpRequest.Headers.Remove(_header.Key);
 793                    }
 0794                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 795                }
 796            }
 797
 798            // Serialize Request
 1799            string _requestContent = null;
 1800            if(content != null)
 801            {
 1802                _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(content, Client.SerializationSettin
 1803                _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
 1804                _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
 805            }
 806            // Set Credentials
 1807            if (Client.Credentials != null)
 808            {
 1809                cancellationToken.ThrowIfCancellationRequested();
 1810                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 811            }
 812            // Send Request
 1813            if (_shouldTrace)
 814            {
 0815                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 816            }
 1817            cancellationToken.ThrowIfCancellationRequested();
 1818            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 1819            if (_shouldTrace)
 820            {
 0821                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 822            }
 1823            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 1824            cancellationToken.ThrowIfCancellationRequested();
 1825            string _responseContent = null;
 1826            if ((int)_statusCode != 200)
 827            {
 0828                var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC
 829                try
 830                {
 0831                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0832                    APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte
 0833                    if (_errorBody != null)
 834                    {
 0835                        ex.Body = _errorBody;
 836                    }
 0837                }
 0838                catch (JsonException)
 839                {
 840                    // Ignore the exception
 0841                }
 0842                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0843                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0844                if (_shouldTrace)
 845                {
 0846                    ServiceClientTracing.Error(_invocationId, ex);
 847                }
 0848                _httpRequest.Dispose();
 0849                if (_httpResponse != null)
 850                {
 0851                    _httpResponse.Dispose();
 852                }
 0853                throw ex;
 854            }
 855            // Create Result
 1856            var _result = new HttpOperationResponse<JobId>();
 1857            _result.Request = _httpRequest;
 1858            _result.Response = _httpResponse;
 859            // Deserialize Response
 1860            if ((int)_statusCode == 200)
 861            {
 1862                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 863                try
 864                {
 1865                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<JobId>(_responseContent, Client.
 1866                }
 0867                catch (JsonException ex)
 868                {
 0869                    _httpRequest.Dispose();
 0870                    if (_httpResponse != null)
 871                    {
 0872                        _httpResponse.Dispose();
 873                    }
 0874                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 875                }
 876            }
 1877            if (_shouldTrace)
 878            {
 0879                ServiceClientTracing.Exit(_invocationId, _result);
 880            }
 1881            return _result;
 1882        }
 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        /// &lt;h3&gt;CallBack Schemas &lt;/h3&gt;
 890        /// &lt;h4&gt;Review Completion CallBack Sample&lt;/h4&gt;
 891        /// &lt;p&gt;
 892        /// {&lt;br/&gt;
 893        /// "ReviewId": "&lt;Review Id&gt;",&lt;br/&gt;
 894        /// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",&lt;br/&gt;
 895        /// "ModifiedBy": "&lt;Name of the Reviewer&gt;",&lt;br/&gt;
 896        /// "CallBackType": "Review",&lt;br/&gt;
 897        /// "ContentId": "&lt;The ContentId that was specified input&gt;",&lt;br/&gt;
 898        /// "Metadata": {&lt;br/&gt;
 899        /// "adultscore": "0.xxx",&lt;br/&gt;
 900        /// "a": "False",&lt;br/&gt;
 901        /// "racyscore": "0.xxx",&lt;br/&gt;
 902        /// "r": "True"&lt;br/&gt;
 903        /// },&lt;br/&gt;
 904        /// "ReviewerResultTags": {&lt;br/&gt;
 905        /// "a": "False",&lt;br/&gt;
 906        /// "r": "True"&lt;br/&gt;
 907        /// }&lt;br/&gt;
 908        /// }&lt;br/&gt;
 909        ///
 910        /// &lt;/p&gt;.
 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        {
 0941            if (Client.Endpoint == null)
 942            {
 0943                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint");
 944            }
 0945            if (teamName == null)
 946            {
 0947                throw new ValidationException(ValidationRules.CannotBeNull, "teamName");
 948            }
 0949            if (reviewId == null)
 950            {
 0951                throw new ValidationException(ValidationRules.CannotBeNull, "reviewId");
 952            }
 953            // Tracing
 0954            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 0955            string _invocationId = null;
 0956            if (_shouldTrace)
 957            {
 0958                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0959                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0960                tracingParameters.Add("teamName", teamName);
 0961                tracingParameters.Add("reviewId", reviewId);
 0962                tracingParameters.Add("timescale", timescale);
 0963                tracingParameters.Add("cancellationToken", cancellationToken);
 0964                ServiceClientTracing.Enter(_invocationId, this, "AddVideoFrame", tracingParameters);
 965            }
 966            // Construct URL
 0967            var _baseUrl = Client.BaseUri;
 0968            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r
 0969            _url = _url.Replace("{Endpoint}", Client.Endpoint);
 0970            _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName));
 0971            _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId));
 0972            List<string> _queryParameters = new List<string>();
 0973            if (timescale != null)
 974            {
 0975                _queryParameters.Add(string.Format("timescale={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJ
 976            }
 0977            if (_queryParameters.Count > 0)
 978            {
 0979                _url += "?" + string.Join("&", _queryParameters);
 980            }
 981            // Create HTTP transport objects
 0982            var _httpRequest = new HttpRequestMessage();
 0983            HttpResponseMessage _httpResponse = null;
 0984            _httpRequest.Method = new HttpMethod("POST");
 0985            _httpRequest.RequestUri = new System.Uri(_url);
 986            // Set Headers
 987
 988
 0989            if (customHeaders != null)
 990            {
 0991                foreach(var _header in customHeaders)
 992                {
 0993                    if (_httpRequest.Headers.Contains(_header.Key))
 994                    {
 0995                        _httpRequest.Headers.Remove(_header.Key);
 996                    }
 0997                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 998                }
 999            }
 1000
 1001            // Serialize Request
 01002            string _requestContent = null;
 1003            // Set Credentials
 01004            if (Client.Credentials != null)
 1005            {
 01006                cancellationToken.ThrowIfCancellationRequested();
 01007                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 1008            }
 1009            // Send Request
 01010            if (_shouldTrace)
 1011            {
 01012                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 1013            }
 01014            cancellationToken.ThrowIfCancellationRequested();
 01015            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 01016            if (_shouldTrace)
 1017            {
 01018                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 1019            }
 01020            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 01021            cancellationToken.ThrowIfCancellationRequested();
 01022            string _responseContent = null;
 01023            if ((int)_statusCode != 200)
 1024            {
 01025                var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC
 1026                try
 1027                {
 01028                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 01029                    APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte
 01030                    if (_errorBody != null)
 1031                    {
 01032                        ex.Body = _errorBody;
 1033                    }
 01034                }
 01035                catch (JsonException)
 1036                {
 1037                    // Ignore the exception
 01038                }
 01039                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 01040                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 01041                if (_shouldTrace)
 1042                {
 01043                    ServiceClientTracing.Error(_invocationId, ex);
 1044                }
 01045                _httpRequest.Dispose();
 01046                if (_httpResponse != null)
 1047                {
 01048                    _httpResponse.Dispose();
 1049                }
 01050                throw ex;
 1051            }
 1052            // Create Result
 01053            var _result = new HttpOperationResponse();
 01054            _result.Request = _httpRequest;
 01055            _result.Response = _httpResponse;
 01056            if (_shouldTrace)
 1057            {
 01058                ServiceClientTracing.Exit(_invocationId, _result);
 1059            }
 01060            return _result;
 01061        }
 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        /// &lt;h3&gt;CallBack Schemas &lt;/h3&gt;
 1069        /// &lt;h4&gt;Review Completion CallBack Sample&lt;/h4&gt;
 1070        /// &lt;p&gt;
 1071        /// {&lt;br/&gt;
 1072        /// "ReviewId": "&lt;Review Id&gt;",&lt;br/&gt;
 1073        /// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",&lt;br/&gt;
 1074        /// "ModifiedBy": "&lt;Name of the Reviewer&gt;",&lt;br/&gt;
 1075        /// "CallBackType": "Review",&lt;br/&gt;
 1076        /// "ContentId": "&lt;The ContentId that was specified input&gt;",&lt;br/&gt;
 1077        /// "Metadata": {&lt;br/&gt;
 1078        /// "adultscore": "0.xxx",&lt;br/&gt;
 1079        /// "a": "False",&lt;br/&gt;
 1080        /// "racyscore": "0.xxx",&lt;br/&gt;
 1081        /// "r": "True"&lt;br/&gt;
 1082        /// },&lt;br/&gt;
 1083        /// "ReviewerResultTags": {&lt;br/&gt;
 1084        /// "a": "False",&lt;br/&gt;
 1085        /// "r": "True"&lt;br/&gt;
 1086        /// }&lt;br/&gt;
 1087        /// }&lt;br/&gt;
 1088        ///
 1089        /// &lt;/p&gt;.
 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        {
 01129            if (Client.Endpoint == null)
 1130            {
 01131                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint");
 1132            }
 01133            if (teamName == null)
 1134            {
 01135                throw new ValidationException(ValidationRules.CannotBeNull, "teamName");
 1136            }
 01137            if (reviewId == null)
 1138            {
 01139                throw new ValidationException(ValidationRules.CannotBeNull, "reviewId");
 1140            }
 1141            // Tracing
 01142            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 01143            string _invocationId = null;
 01144            if (_shouldTrace)
 1145            {
 01146                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 01147                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 01148                tracingParameters.Add("teamName", teamName);
 01149                tracingParameters.Add("reviewId", reviewId);
 01150                tracingParameters.Add("startSeed", startSeed);
 01151                tracingParameters.Add("noOfRecords", noOfRecords);
 01152                tracingParameters.Add("filter", filter);
 01153                tracingParameters.Add("cancellationToken", cancellationToken);
 01154                ServiceClientTracing.Enter(_invocationId, this, "GetVideoFrames", tracingParameters);
 1155            }
 1156            // Construct URL
 01157            var _baseUrl = Client.BaseUri;
 01158            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r
 01159            _url = _url.Replace("{Endpoint}", Client.Endpoint);
 01160            _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName));
 01161            _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId));
 01162            List<string> _queryParameters = new List<string>();
 01163            if (startSeed != null)
 1164            {
 01165                _queryParameters.Add(string.Format("startSeed={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJ
 1166            }
 01167            if (noOfRecords != null)
 1168            {
 01169                _queryParameters.Add(string.Format("noOfRecords={0}", System.Uri.EscapeDataString(Rest.Serialization.Saf
 1170            }
 01171            if (filter != null)
 1172            {
 01173                _queryParameters.Add(string.Format("filter={0}", System.Uri.EscapeDataString(filter)));
 1174            }
 01175            if (_queryParameters.Count > 0)
 1176            {
 01177                _url += "?" + string.Join("&", _queryParameters);
 1178            }
 1179            // Create HTTP transport objects
 01180            var _httpRequest = new HttpRequestMessage();
 01181            HttpResponseMessage _httpResponse = null;
 01182            _httpRequest.Method = new HttpMethod("GET");
 01183            _httpRequest.RequestUri = new System.Uri(_url);
 1184            // Set Headers
 1185
 1186
 01187            if (customHeaders != null)
 1188            {
 01189                foreach(var _header in customHeaders)
 1190                {
 01191                    if (_httpRequest.Headers.Contains(_header.Key))
 1192                    {
 01193                        _httpRequest.Headers.Remove(_header.Key);
 1194                    }
 01195                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 1196                }
 1197            }
 1198
 1199            // Serialize Request
 01200            string _requestContent = null;
 1201            // Set Credentials
 01202            if (Client.Credentials != null)
 1203            {
 01204                cancellationToken.ThrowIfCancellationRequested();
 01205                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 1206            }
 1207            // Send Request
 01208            if (_shouldTrace)
 1209            {
 01210                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 1211            }
 01212            cancellationToken.ThrowIfCancellationRequested();
 01213            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 01214            if (_shouldTrace)
 1215            {
 01216                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 1217            }
 01218            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 01219            cancellationToken.ThrowIfCancellationRequested();
 01220            string _responseContent = null;
 01221            if ((int)_statusCode != 200)
 1222            {
 01223                var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC
 1224                try
 1225                {
 01226                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 01227                    APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte
 01228                    if (_errorBody != null)
 1229                    {
 01230                        ex.Body = _errorBody;
 1231                    }
 01232                }
 01233                catch (JsonException)
 1234                {
 1235                    // Ignore the exception
 01236                }
 01237                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 01238                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 01239                if (_shouldTrace)
 1240                {
 01241                    ServiceClientTracing.Error(_invocationId, ex);
 1242                }
 01243                _httpRequest.Dispose();
 01244                if (_httpResponse != null)
 1245                {
 01246                    _httpResponse.Dispose();
 1247                }
 01248                throw ex;
 1249            }
 1250            // Create Result
 01251            var _result = new HttpOperationResponse<Frames>();
 01252            _result.Request = _httpRequest;
 01253            _result.Response = _httpResponse;
 1254            // Deserialize Response
 01255            if ((int)_statusCode == 200)
 1256            {
 01257                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 1258                try
 1259                {
 01260                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Frames>(_responseContent, Client
 01261                }
 01262                catch (JsonException ex)
 1263                {
 01264                    _httpRequest.Dispose();
 01265                    if (_httpResponse != null)
 1266                    {
 01267                        _httpResponse.Dispose();
 1268                    }
 01269                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 1270                }
 1271            }
 01272            if (_shouldTrace)
 1273            {
 01274                ServiceClientTracing.Exit(_invocationId, _result);
 1275            }
 01276            return _result;
 01277        }
 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        {
 01308            if (Client.Endpoint == null)
 1309            {
 01310                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint");
 1311            }
 01312            if (teamName == null)
 1313            {
 01314                throw new ValidationException(ValidationRules.CannotBeNull, "teamName");
 1315            }
 01316            if (reviewId == null)
 1317            {
 01318                throw new ValidationException(ValidationRules.CannotBeNull, "reviewId");
 1319            }
 1320            // Tracing
 01321            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 01322            string _invocationId = null;
 01323            if (_shouldTrace)
 1324            {
 01325                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 01326                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 01327                tracingParameters.Add("teamName", teamName);
 01328                tracingParameters.Add("reviewId", reviewId);
 01329                tracingParameters.Add("cancellationToken", cancellationToken);
 01330                ServiceClientTracing.Enter(_invocationId, this, "PublishVideoReview", tracingParameters);
 1331            }
 1332            // Construct URL
 01333            var _baseUrl = Client.BaseUri;
 01334            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r
 01335            _url = _url.Replace("{Endpoint}", Client.Endpoint);
 01336            _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName));
 01337            _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId));
 1338            // Create HTTP transport objects
 01339            var _httpRequest = new HttpRequestMessage();
 01340            HttpResponseMessage _httpResponse = null;
 01341            _httpRequest.Method = new HttpMethod("POST");
 01342            _httpRequest.RequestUri = new System.Uri(_url);
 1343            // Set Headers
 1344
 1345
 01346            if (customHeaders != null)
 1347            {
 01348                foreach(var _header in customHeaders)
 1349                {
 01350                    if (_httpRequest.Headers.Contains(_header.Key))
 1351                    {
 01352                        _httpRequest.Headers.Remove(_header.Key);
 1353                    }
 01354                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 1355                }
 1356            }
 1357
 1358            // Serialize Request
 01359            string _requestContent = null;
 1360            // Set Credentials
 01361            if (Client.Credentials != null)
 1362            {
 01363                cancellationToken.ThrowIfCancellationRequested();
 01364                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 1365            }
 1366            // Send Request
 01367            if (_shouldTrace)
 1368            {
 01369                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 1370            }
 01371            cancellationToken.ThrowIfCancellationRequested();
 01372            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 01373            if (_shouldTrace)
 1374            {
 01375                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 1376            }
 01377            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 01378            cancellationToken.ThrowIfCancellationRequested();
 01379            string _responseContent = null;
 01380            if ((int)_statusCode != 204)
 1381            {
 01382                var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC
 1383                try
 1384                {
 01385                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 01386                    APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte
 01387                    if (_errorBody != null)
 1388                    {
 01389                        ex.Body = _errorBody;
 1390                    }
 01391                }
 01392                catch (JsonException)
 1393                {
 1394                    // Ignore the exception
 01395                }
 01396                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 01397                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 01398                if (_shouldTrace)
 1399                {
 01400                    ServiceClientTracing.Error(_invocationId, ex);
 1401                }
 01402                _httpRequest.Dispose();
 01403                if (_httpResponse != null)
 1404                {
 01405                    _httpResponse.Dispose();
 1406                }
 01407                throw ex;
 1408            }
 1409            // Create Result
 01410            var _result = new HttpOperationResponse();
 01411            _result.Request = _httpRequest;
 01412            _result.Response = _httpResponse;
 01413            if (_shouldTrace)
 1414            {
 01415                ServiceClientTracing.Exit(_invocationId, _result);
 1416            }
 01417            return _result;
 01418        }
 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        {
 01458            if (Client.Endpoint == null)
 1459            {
 01460                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint");
 1461            }
 01462            if (contentType == null)
 1463            {
 01464                throw new ValidationException(ValidationRules.CannotBeNull, "contentType");
 1465            }
 01466            if (teamName == null)
 1467            {
 01468                throw new ValidationException(ValidationRules.CannotBeNull, "teamName");
 1469            }
 01470            if (reviewId == null)
 1471            {
 01472                throw new ValidationException(ValidationRules.CannotBeNull, "reviewId");
 1473            }
 01474            if (transcriptModerationBody == null)
 1475            {
 01476                throw new ValidationException(ValidationRules.CannotBeNull, "transcriptModerationBody");
 1477            }
 01478            if (transcriptModerationBody != null)
 1479            {
 01480                foreach (var element in transcriptModerationBody)
 1481                {
 01482                    if (element != null)
 1483                    {
 01484                        element.Validate();
 1485                    }
 1486                }
 1487            }
 1488            // Tracing
 01489            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 01490            string _invocationId = null;
 01491            if (_shouldTrace)
 1492            {
 01493                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 01494                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 01495                tracingParameters.Add("contentType", contentType);
 01496                tracingParameters.Add("teamName", teamName);
 01497                tracingParameters.Add("reviewId", reviewId);
 01498                tracingParameters.Add("transcriptModerationBody", transcriptModerationBody);
 01499                tracingParameters.Add("cancellationToken", cancellationToken);
 01500                ServiceClientTracing.Enter(_invocationId, this, "AddVideoTranscriptModerationResult", tracingParameters)
 1501            }
 1502            // Construct URL
 01503            var _baseUrl = Client.BaseUri;
 01504            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r
 01505            _url = _url.Replace("{Endpoint}", Client.Endpoint);
 01506            _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName));
 01507            _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId));
 1508            // Create HTTP transport objects
 01509            var _httpRequest = new HttpRequestMessage();
 01510            HttpResponseMessage _httpResponse = null;
 01511            _httpRequest.Method = new HttpMethod("PUT");
 01512            _httpRequest.RequestUri = new System.Uri(_url);
 1513            // Set Headers
 1514
 1515
 01516            if (customHeaders != null)
 1517            {
 01518                foreach(var _header in customHeaders)
 1519                {
 01520                    if (_httpRequest.Headers.Contains(_header.Key))
 1521                    {
 01522                        _httpRequest.Headers.Remove(_header.Key);
 1523                    }
 01524                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 1525                }
 1526            }
 1527
 1528            // Serialize Request
 01529            string _requestContent = null;
 01530            if(transcriptModerationBody != null)
 1531            {
 01532                _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(transcriptModerationBody, Client.Se
 01533                _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
 01534                _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
 1535            }
 1536            // Set Credentials
 01537            if (Client.Credentials != null)
 1538            {
 01539                cancellationToken.ThrowIfCancellationRequested();
 01540                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 1541            }
 1542            // Send Request
 01543            if (_shouldTrace)
 1544            {
 01545                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 1546            }
 01547            cancellationToken.ThrowIfCancellationRequested();
 01548            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 01549            if (_shouldTrace)
 1550            {
 01551                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 1552            }
 01553            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 01554            cancellationToken.ThrowIfCancellationRequested();
 01555            string _responseContent = null;
 01556            if ((int)_statusCode != 204)
 1557            {
 01558                var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC
 1559                try
 1560                {
 01561                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 01562                    APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte
 01563                    if (_errorBody != null)
 1564                    {
 01565                        ex.Body = _errorBody;
 1566                    }
 01567                }
 01568                catch (JsonException)
 1569                {
 1570                    // Ignore the exception
 01571                }
 01572                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 01573                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 01574                if (_shouldTrace)
 1575                {
 01576                    ServiceClientTracing.Error(_invocationId, ex);
 1577                }
 01578                _httpRequest.Dispose();
 01579                if (_httpResponse != null)
 1580                {
 01581                    _httpResponse.Dispose();
 1582                }
 01583                throw ex;
 1584            }
 1585            // Create Result
 01586            var _result = new HttpOperationResponse();
 01587            _result.Request = _httpRequest;
 01588            _result.Response = _httpResponse;
 01589            if (_shouldTrace)
 1590            {
 01591                ServiceClientTracing.Exit(_invocationId, _result);
 1592            }
 01593            return _result;
 01594        }
 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        {
 01629            if (Client.Endpoint == null)
 1630            {
 01631                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint");
 1632            }
 01633            if (teamName == null)
 1634            {
 01635                throw new ValidationException(ValidationRules.CannotBeNull, "teamName");
 1636            }
 01637            if (reviewId == null)
 1638            {
 01639                throw new ValidationException(ValidationRules.CannotBeNull, "reviewId");
 1640            }
 01641            if (vTTfile == null)
 1642            {
 01643                throw new ValidationException(ValidationRules.CannotBeNull, "vTTfile");
 1644            }
 01645            string contentType = "text/plain";
 1646            // Tracing
 01647            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 01648            string _invocationId = null;
 01649            if (_shouldTrace)
 1650            {
 01651                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 01652                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 01653                tracingParameters.Add("teamName", teamName);
 01654                tracingParameters.Add("reviewId", reviewId);
 01655                tracingParameters.Add("contentType", contentType);
 01656                tracingParameters.Add("vTTfile", vTTfile);
 01657                tracingParameters.Add("cancellationToken", cancellationToken);
 01658                ServiceClientTracing.Enter(_invocationId, this, "AddVideoTranscript", tracingParameters);
 1659            }
 1660            // Construct URL
 01661            var _baseUrl = Client.BaseUri;
 01662            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r
 01663            _url = _url.Replace("{Endpoint}", Client.Endpoint);
 01664            _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName));
 01665            _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId));
 1666            // Create HTTP transport objects
 01667            var _httpRequest = new HttpRequestMessage();
 01668            HttpResponseMessage _httpResponse = null;
 01669            _httpRequest.Method = new HttpMethod("PUT");
 01670            _httpRequest.RequestUri = new System.Uri(_url);
 1671            // Set Headers
 1672
 1673
 01674            if (customHeaders != null)
 1675            {
 01676                foreach(var _header in customHeaders)
 1677                {
 01678                    if (_httpRequest.Headers.Contains(_header.Key))
 1679                    {
 01680                        _httpRequest.Headers.Remove(_header.Key);
 1681                    }
 01682                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 1683                }
 1684            }
 1685
 1686            // Serialize Request
 01687            string _requestContent = null;
 01688            if(vTTfile == null)
 1689            {
 01690              throw new System.ArgumentNullException("vTTfile");
 1691            }
 01692            if (vTTfile != null && vTTfile != Stream.Null)
 1693            {
 01694                _httpRequest.Content = new StreamContent(vTTfile);
 01695                _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("text/plain");
 1696            }
 1697            // Set Credentials
 01698            if (Client.Credentials != null)
 1699            {
 01700                cancellationToken.ThrowIfCancellationRequested();
 01701                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 1702            }
 1703            // Send Request
 01704            if (_shouldTrace)
 1705            {
 01706                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 1707            }
 01708            cancellationToken.ThrowIfCancellationRequested();
 01709            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 01710            if (_shouldTrace)
 1711            {
 01712                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 1713            }
 01714            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 01715            cancellationToken.ThrowIfCancellationRequested();
 01716            string _responseContent = null;
 01717            if ((int)_statusCode != 204)
 1718            {
 01719                var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC
 1720                try
 1721                {
 01722                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 01723                    APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte
 01724                    if (_errorBody != null)
 1725                    {
 01726                        ex.Body = _errorBody;
 1727                    }
 01728                }
 01729                catch (JsonException)
 1730                {
 1731                    // Ignore the exception
 01732                }
 01733                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 01734                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 01735                if (_shouldTrace)
 1736                {
 01737                    ServiceClientTracing.Error(_invocationId, ex);
 1738                }
 01739                _httpRequest.Dispose();
 01740                if (_httpResponse != null)
 1741                {
 01742                    _httpResponse.Dispose();
 1743                }
 01744                throw ex;
 1745            }
 1746            // Create Result
 01747            var _result = new HttpOperationResponse();
 01748            _result.Request = _httpRequest;
 01749            _result.Response = _httpResponse;
 01750            if (_shouldTrace)
 1751            {
 01752                ServiceClientTracing.Exit(_invocationId, _result);
 1753            }
 01754            return _result;
 01755        }
 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        /// &lt;h3&gt;CallBack Schemas &lt;/h3&gt;
 1763        /// &lt;h4&gt;Review Completion CallBack Sample&lt;/h4&gt;
 1764        /// &lt;p&gt;
 1765        /// {&lt;br/&gt;
 1766        /// "ReviewId": "&lt;Review Id&gt;",&lt;br/&gt;
 1767        /// "ModifiedOn": "2016-10-11T22:36:32.9934851Z",&lt;br/&gt;
 1768        /// "ModifiedBy": "&lt;Name of the Reviewer&gt;",&lt;br/&gt;
 1769        /// "CallBackType": "Review",&lt;br/&gt;
 1770        /// "ContentId": "&lt;The ContentId that was specified input&gt;",&lt;br/&gt;
 1771        /// "Metadata": {&lt;br/&gt;
 1772        /// "adultscore": "0.xxx",&lt;br/&gt;
 1773        /// "a": "False",&lt;br/&gt;
 1774        /// "racyscore": "0.xxx",&lt;br/&gt;
 1775        /// "r": "True"&lt;br/&gt;
 1776        /// },&lt;br/&gt;
 1777        /// "ReviewerResultTags": {&lt;br/&gt;
 1778        /// "a": "False",&lt;br/&gt;
 1779        /// "r": "True"&lt;br/&gt;
 1780        /// }&lt;br/&gt;
 1781        /// }&lt;br/&gt;
 1782        ///
 1783        /// &lt;/p&gt;.
 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        {
 11820            if (Client.Endpoint == null)
 1821            {
 01822                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint");
 1823            }
 11824            if (contentType == null)
 1825            {
 01826                throw new ValidationException(ValidationRules.CannotBeNull, "contentType");
 1827            }
 11828            if (teamName == null)
 1829            {
 01830                throw new ValidationException(ValidationRules.CannotBeNull, "teamName");
 1831            }
 11832            if (createVideoReviewsBody == null)
 1833            {
 01834                throw new ValidationException(ValidationRules.CannotBeNull, "createVideoReviewsBody");
 1835            }
 11836            if (createVideoReviewsBody != null)
 1837            {
 41838                foreach (var element in createVideoReviewsBody)
 1839                {
 11840                    if (element != null)
 1841                    {
 11842                        element.Validate();
 1843                    }
 1844                }
 1845            }
 1846            // Tracing
 11847            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 11848            string _invocationId = null;
 11849            if (_shouldTrace)
 1850            {
 01851                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 01852                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 01853                tracingParameters.Add("contentType", contentType);
 01854                tracingParameters.Add("teamName", teamName);
 01855                tracingParameters.Add("subTeam", subTeam);
 01856                tracingParameters.Add("createVideoReviewsBody", createVideoReviewsBody);
 01857                tracingParameters.Add("cancellationToken", cancellationToken);
 01858                ServiceClientTracing.Enter(_invocationId, this, "CreateVideoReviews", tracingParameters);
 1859            }
 1860            // Construct URL
 11861            var _baseUrl = Client.BaseUri;
 11862            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r
 11863            _url = _url.Replace("{Endpoint}", Client.Endpoint);
 11864            _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName));
 11865            List<string> _queryParameters = new List<string>();
 11866            if (subTeam != null)
 1867            {
 01868                _queryParameters.Add(string.Format("subTeam={0}", System.Uri.EscapeDataString(subTeam)));
 1869            }
 11870            if (_queryParameters.Count > 0)
 1871            {
 01872                _url += "?" + string.Join("&", _queryParameters);
 1873            }
 1874            // Create HTTP transport objects
 11875            var _httpRequest = new HttpRequestMessage();
 11876            HttpResponseMessage _httpResponse = null;
 11877            _httpRequest.Method = new HttpMethod("POST");
 11878            _httpRequest.RequestUri = new System.Uri(_url);
 1879            // Set Headers
 1880
 1881
 11882            if (customHeaders != null)
 1883            {
 01884                foreach(var _header in customHeaders)
 1885                {
 01886                    if (_httpRequest.Headers.Contains(_header.Key))
 1887                    {
 01888                        _httpRequest.Headers.Remove(_header.Key);
 1889                    }
 01890                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 1891                }
 1892            }
 1893
 1894            // Serialize Request
 11895            string _requestContent = null;
 11896            if(createVideoReviewsBody != null)
 1897            {
 11898                _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createVideoReviewsBody, Client.Seri
 11899                _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
 11900                _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
 1901            }
 1902            // Set Credentials
 11903            if (Client.Credentials != null)
 1904            {
 11905                cancellationToken.ThrowIfCancellationRequested();
 11906                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 1907            }
 1908            // Send Request
 11909            if (_shouldTrace)
 1910            {
 01911                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 1912            }
 11913            cancellationToken.ThrowIfCancellationRequested();
 11914            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 11915            if (_shouldTrace)
 1916            {
 01917                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 1918            }
 11919            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 11920            cancellationToken.ThrowIfCancellationRequested();
 11921            string _responseContent = null;
 11922            if ((int)_statusCode != 200)
 1923            {
 01924                var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC
 1925                try
 1926                {
 01927                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 01928                    APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte
 01929                    if (_errorBody != null)
 1930                    {
 01931                        ex.Body = _errorBody;
 1932                    }
 01933                }
 01934                catch (JsonException)
 1935                {
 1936                    // Ignore the exception
 01937                }
 01938                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 01939                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 01940                if (_shouldTrace)
 1941                {
 01942                    ServiceClientTracing.Error(_invocationId, ex);
 1943                }
 01944                _httpRequest.Dispose();
 01945                if (_httpResponse != null)
 1946                {
 01947                    _httpResponse.Dispose();
 1948                }
 01949                throw ex;
 1950            }
 1951            // Create Result
 11952            var _result = new HttpOperationResponse<IList<string>>();
 11953            _result.Request = _httpRequest;
 11954            _result.Response = _httpResponse;
 1955            // Deserialize Response
 11956            if ((int)_statusCode == 200)
 1957            {
 11958                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 1959                try
 1960                {
 11961                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<IList<string>>(_responseContent,
 11962                }
 01963                catch (JsonException ex)
 1964                {
 01965                    _httpRequest.Dispose();
 01966                    if (_httpResponse != null)
 1967                    {
 01968                        _httpResponse.Dispose();
 1969                    }
 01970                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 1971                }
 1972            }
 11973            if (_shouldTrace)
 1974            {
 01975                ServiceClientTracing.Exit(_invocationId, _result);
 1976            }
 11977            return _result;
 11978        }
 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        {
 02022            if (Client.Endpoint == null)
 2023            {
 02024                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint");
 2025            }
 02026            if (contentType == null)
 2027            {
 02028                throw new ValidationException(ValidationRules.CannotBeNull, "contentType");
 2029            }
 02030            if (teamName == null)
 2031            {
 02032                throw new ValidationException(ValidationRules.CannotBeNull, "teamName");
 2033            }
 02034            if (reviewId == null)
 2035            {
 02036                throw new ValidationException(ValidationRules.CannotBeNull, "reviewId");
 2037            }
 02038            if (videoFrameBody == null)
 2039            {
 02040                throw new ValidationException(ValidationRules.CannotBeNull, "videoFrameBody");
 2041            }
 02042            if (videoFrameBody != null)
 2043            {
 02044                foreach (var element in videoFrameBody)
 2045                {
 02046                    if (element != null)
 2047                    {
 02048                        element.Validate();
 2049                    }
 2050                }
 2051            }
 2052            // Tracing
 02053            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 02054            string _invocationId = null;
 02055            if (_shouldTrace)
 2056            {
 02057                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 02058                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 02059                tracingParameters.Add("contentType", contentType);
 02060                tracingParameters.Add("teamName", teamName);
 02061                tracingParameters.Add("reviewId", reviewId);
 02062                tracingParameters.Add("timescale", timescale);
 02063                tracingParameters.Add("videoFrameBody", videoFrameBody);
 02064                tracingParameters.Add("cancellationToken", cancellationToken);
 02065                ServiceClientTracing.Enter(_invocationId, this, "AddVideoFrameUrl", tracingParameters);
 2066            }
 2067            // Construct URL
 02068            var _baseUrl = Client.BaseUri;
 02069            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "contentmoderator/review/v1.0/teams/{teamName}/r
 02070            _url = _url.Replace("{Endpoint}", Client.Endpoint);
 02071            _url = _url.Replace("{teamName}", System.Uri.EscapeDataString(teamName));
 02072            _url = _url.Replace("{reviewId}", System.Uri.EscapeDataString(reviewId));
 02073            List<string> _queryParameters = new List<string>();
 02074            if (timescale != null)
 2075            {
 02076                _queryParameters.Add(string.Format("timescale={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJ
 2077            }
 02078            if (_queryParameters.Count > 0)
 2079            {
 02080                _url += "?" + string.Join("&", _queryParameters);
 2081            }
 2082            // Create HTTP transport objects
 02083            var _httpRequest = new HttpRequestMessage();
 02084            HttpResponseMessage _httpResponse = null;
 02085            _httpRequest.Method = new HttpMethod("POST");
 02086            _httpRequest.RequestUri = new System.Uri(_url);
 2087            // Set Headers
 2088
 2089
 02090            if (customHeaders != null)
 2091            {
 02092                foreach(var _header in customHeaders)
 2093                {
 02094                    if (_httpRequest.Headers.Contains(_header.Key))
 2095                    {
 02096                        _httpRequest.Headers.Remove(_header.Key);
 2097                    }
 02098                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 2099                }
 2100            }
 2101
 2102            // Serialize Request
 02103            string _requestContent = null;
 02104            if(videoFrameBody != null)
 2105            {
 02106                _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(videoFrameBody, Client.Serializatio
 02107                _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
 02108                _httpRequest.Content.Headers.ContentType =MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
 2109            }
 2110            // Set Credentials
 02111            if (Client.Credentials != null)
 2112            {
 02113                cancellationToken.ThrowIfCancellationRequested();
 02114                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 2115            }
 2116            // Send Request
 02117            if (_shouldTrace)
 2118            {
 02119                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 2120            }
 02121            cancellationToken.ThrowIfCancellationRequested();
 02122            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 02123            if (_shouldTrace)
 2124            {
 02125                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 2126            }
 02127            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 02128            cancellationToken.ThrowIfCancellationRequested();
 02129            string _responseContent = null;
 02130            if ((int)_statusCode != 204)
 2131            {
 02132                var ex = new APIErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusC
 2133                try
 2134                {
 02135                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 02136                    APIError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<APIError>(_responseConte
 02137                    if (_errorBody != null)
 2138                    {
 02139                        ex.Body = _errorBody;
 2140                    }
 02141                }
 02142                catch (JsonException)
 2143                {
 2144                    // Ignore the exception
 02145                }
 02146                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 02147                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 02148                if (_shouldTrace)
 2149                {
 02150                    ServiceClientTracing.Error(_invocationId, ex);
 2151                }
 02152                _httpRequest.Dispose();
 02153                if (_httpResponse != null)
 2154                {
 02155                    _httpResponse.Dispose();
 2156                }
 02157                throw ex;
 2158            }
 2159            // Create Result
 02160            var _result = new HttpOperationResponse();
 02161            _result.Request = _httpRequest;
 02162            _result.Response = _httpResponse;
 02163            if (_shouldTrace)
 2164            {
 02165                ServiceClientTracing.Exit(_invocationId, _result);
 2166            }
 02167            return _result;
 02168        }
 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";
 02302                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}