# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::CognitiveServices::ContentModerator::V1_0
  #
  # You use the API to scan your content as it is generated. Content Moderator
  # then processes your content and sends the results along with relevant
  # information either back to your systems or to the built-in review tool. You
  # can use this information to take decisions e.g. take it down, send to human
  # judge, etc.
  #
  # When using the API, images need to have a minimum of 128 pixels and a
  # maximum file size of 4MB.
  # Text can be at most 1024 characters long.
  # If the content passed to the text API or the image API exceeds the size
  # limits, the API will return an error code that informs about the issue.
  #
  class Reviews
    include MsRestAzure

    #
    # Creates and initializes a new instance of the Reviews class.
    # @param client service class for accessing basic functionality.
    #
    def initialize(client)
      @client = client
    end

    # @return [ContentModeratorClient] reference to the ContentModeratorClient
    attr_reader :client

    #
    # Returns review details for the review Id passed.
    #
    # @param team_name [String] Your Team Name.
    # @param review_id [String] Id of the review.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Review] operation results.
    #
    def get_review(team_name, review_id, custom_headers:nil)
      response = get_review_async(team_name, review_id, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Returns review details for the review Id passed.
    #
    # @param team_name [String] Your Team Name.
    # @param review_id [String] Id of the review.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def get_review_with_http_info(team_name, review_id, custom_headers:nil)
      get_review_async(team_name, review_id, custom_headers:custom_headers).value!
    end

    #
    # Returns review details for the review Id passed.
    #
    # @param team_name [String] Your Team Name.
    # @param review_id [String] Id of the review.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def get_review_async(team_name, review_id, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'review_id is nil' if review_id.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name,'reviewId' => review_id},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::CognitiveServices::ContentModerator::V1_0::Models::Review.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Get the Job Details for a Job Id.
    #
    # @param team_name [String] Your Team Name.
    # @param job_id [String] Id of the job.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Job] operation results.
    #
    def get_job_details(team_name, job_id, custom_headers:nil)
      response = get_job_details_async(team_name, job_id, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Get the Job Details for a Job Id.
    #
    # @param team_name [String] Your Team Name.
    # @param job_id [String] Id of the job.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def get_job_details_with_http_info(team_name, job_id, custom_headers:nil)
      get_job_details_async(team_name, job_id, custom_headers:custom_headers).value!
    end

    #
    # Get the Job Details for a Job Id.
    #
    # @param team_name [String] Your Team Name.
    # @param job_id [String] Id of the job.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def get_job_details_async(team_name, job_id, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'job_id is nil' if job_id.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/jobs/{JobId}'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name,'JobId' => job_id},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::CognitiveServices::ContentModerator::V1_0::Models::Job.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param url_content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param create_review_body [Array<CreateReviewBodyItem>] Body for create
    # reviews API
    # @param sub_team [String] SubTeam of your team, you want to assign the created
    # review to.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def create_reviews(url_content_type, team_name, create_review_body, sub_team:nil, custom_headers:nil)
      response = create_reviews_async(url_content_type, team_name, create_review_body, sub_team:sub_team, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param url_content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param create_review_body [Array<CreateReviewBodyItem>] Body for create
    # reviews API
    # @param sub_team [String] SubTeam of your team, you want to assign the created
    # review to.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def create_reviews_with_http_info(url_content_type, team_name, create_review_body, sub_team:nil, custom_headers:nil)
      create_reviews_async(url_content_type, team_name, create_review_body, sub_team:sub_team, custom_headers:custom_headers).value!
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param url_content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param create_review_body [Array<CreateReviewBodyItem>] Body for create
    # reviews API
    # @param sub_team [String] SubTeam of your team, you want to assign the created
    # review to.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def create_reviews_async(url_content_type, team_name, create_review_body, sub_team:nil, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'url_content_type is nil' if url_content_type.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'create_review_body is nil' if create_review_body.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['UrlContentType'] = url_content_type unless url_content_type.nil?
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = {
        client_side_validation: true,
        required: true,
        serialized_name: 'createReviewBody',
        type: {
          name: 'Sequence',
          element: {
              client_side_validation: true,
              required: false,
              serialized_name: 'CreateReviewBodyItemElementType',
              type: {
                name: 'Composite',
                class_name: 'CreateReviewBodyItem'
              }
          }
        }
      }
      request_content = @client.serialize(request_mapper,  create_review_body)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name},
          query_params: {'subTeam' => sub_team},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:post, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'StringElementType',
                    type: {
                      name: 'String'
                    }
                }
              }
            }
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # A job Id will be returned for the content posted on this endpoint.
    #
    # Once the content is evaluated against the Workflow provided the review will
    # be created or ignored based on the workflow expression.
    #
    # <h3>CallBack Schemas </h3>
    #
    # <p>
    # <h4>Job Completion CallBack Sample</h4><br/>
    #
    # {<br/>
    # "JobId": "<Job Id>,<br/>
    # "ReviewId": "<Review Id, if the Job resulted in a Review to be
    # created>",<br/>
    # "WorkFlowId": "default",<br/>
    # "Status": "<This will be one of Complete, InProgress, Error>",<br/>
    # "ContentType": "Image",<br/>
    # "ContentId": "<This is the ContentId that was specified on input>",<br/>
    # "CallBackType": "Job",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>
    # <p>
    # <h4>Review Completion CallBack Sample</h4><br/>
    #
    # {
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param team_name [String] Your team name.
    # @param content_type [Enum] Image, Text or Video. Possible values include:
    # 'Image', 'Text', 'Video'
    # @param content_id [String] Id/Name to identify the content submitted.
    # @param workflow_name [String] Workflow Name that you want to invoke.
    # @param job_content_type [Enum] The content type. Possible values include:
    # 'application/json', 'image/jpeg'
    # @param content [Content] Content to evaluate.
    # @param call_back_endpoint [String] Callback endpoint for posting the create
    # job result.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [JobId] operation results.
    #
    def create_job(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:nil, custom_headers:nil)
      response = create_job_async(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:call_back_endpoint, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # A job Id will be returned for the content posted on this endpoint.
    #
    # Once the content is evaluated against the Workflow provided the review will
    # be created or ignored based on the workflow expression.
    #
    # <h3>CallBack Schemas </h3>
    #
    # <p>
    # <h4>Job Completion CallBack Sample</h4><br/>
    #
    # {<br/>
    # "JobId": "<Job Id>,<br/>
    # "ReviewId": "<Review Id, if the Job resulted in a Review to be
    # created>",<br/>
    # "WorkFlowId": "default",<br/>
    # "Status": "<This will be one of Complete, InProgress, Error>",<br/>
    # "ContentType": "Image",<br/>
    # "ContentId": "<This is the ContentId that was specified on input>",<br/>
    # "CallBackType": "Job",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>
    # <p>
    # <h4>Review Completion CallBack Sample</h4><br/>
    #
    # {
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param team_name [String] Your team name.
    # @param content_type [Enum] Image, Text or Video. Possible values include:
    # 'Image', 'Text', 'Video'
    # @param content_id [String] Id/Name to identify the content submitted.
    # @param workflow_name [String] Workflow Name that you want to invoke.
    # @param job_content_type [Enum] The content type. Possible values include:
    # 'application/json', 'image/jpeg'
    # @param content [Content] Content to evaluate.
    # @param call_back_endpoint [String] Callback endpoint for posting the create
    # job result.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def create_job_with_http_info(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:nil, custom_headers:nil)
      create_job_async(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:call_back_endpoint, custom_headers:custom_headers).value!
    end

    #
    # A job Id will be returned for the content posted on this endpoint.
    #
    # Once the content is evaluated against the Workflow provided the review will
    # be created or ignored based on the workflow expression.
    #
    # <h3>CallBack Schemas </h3>
    #
    # <p>
    # <h4>Job Completion CallBack Sample</h4><br/>
    #
    # {<br/>
    # "JobId": "<Job Id>,<br/>
    # "ReviewId": "<Review Id, if the Job resulted in a Review to be
    # created>",<br/>
    # "WorkFlowId": "default",<br/>
    # "Status": "<This will be one of Complete, InProgress, Error>",<br/>
    # "ContentType": "Image",<br/>
    # "ContentId": "<This is the ContentId that was specified on input>",<br/>
    # "CallBackType": "Job",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>
    # <p>
    # <h4>Review Completion CallBack Sample</h4><br/>
    #
    # {
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param team_name [String] Your team name.
    # @param content_type [Enum] Image, Text or Video. Possible values include:
    # 'Image', 'Text', 'Video'
    # @param content_id [String] Id/Name to identify the content submitted.
    # @param workflow_name [String] Workflow Name that you want to invoke.
    # @param job_content_type [Enum] The content type. Possible values include:
    # 'application/json', 'image/jpeg'
    # @param content [Content] Content to evaluate.
    # @param call_back_endpoint [String] Callback endpoint for posting the create
    # job result.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def create_job_async(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:nil, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'content_type is nil' if content_type.nil?
      fail ArgumentError, 'content_id is nil' if content_id.nil?
      fail ArgumentError, 'workflow_name is nil' if workflow_name.nil?
      fail ArgumentError, 'job_content_type is nil' if job_content_type.nil?
      fail ArgumentError, 'content is nil' if content.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['Content-Type'] = job_content_type.to_s unless job_content_type.to_s.nil?
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = Azure::CognitiveServices::ContentModerator::V1_0::Models::Content.mapper()
      request_content = @client.serialize(request_mapper,  content)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/jobs'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name},
          query_params: {'ContentType' => content_type,'ContentId' => content_id,'WorkflowName' => workflow_name,'CallBackEndpoint' => call_back_endpoint},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:post, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::CognitiveServices::ContentModerator::V1_0::Models::JobId.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param timescale [Integer] Timescale of the video you are adding frames to.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def add_video_frame(team_name, review_id, timescale:nil, custom_headers:nil)
      response = add_video_frame_async(team_name, review_id, timescale:timescale, custom_headers:custom_headers).value!
      nil
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param timescale [Integer] Timescale of the video you are adding frames to.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def add_video_frame_with_http_info(team_name, review_id, timescale:nil, custom_headers:nil)
      add_video_frame_async(team_name, review_id, timescale:timescale, custom_headers:custom_headers).value!
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param timescale [Integer] Timescale of the video you are adding frames to.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def add_video_frame_async(team_name, review_id, timescale:nil, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'review_id is nil' if review_id.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name,'reviewId' => review_id},
          query_params: {'timescale' => timescale},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:post, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param start_seed [Integer] Time stamp of the frame from where you want to
    # start fetching the frames.
    # @param no_of_records [Integer] Number of frames to fetch.
    # @param filter [String] Get frames filtered by tags.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Frames] operation results.
    #
    def get_video_frames(team_name, review_id, start_seed:nil, no_of_records:nil, filter:nil, custom_headers:nil)
      response = get_video_frames_async(team_name, review_id, start_seed:start_seed, no_of_records:no_of_records, filter:filter, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param start_seed [Integer] Time stamp of the frame from where you want to
    # start fetching the frames.
    # @param no_of_records [Integer] Number of frames to fetch.
    # @param filter [String] Get frames filtered by tags.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def get_video_frames_with_http_info(team_name, review_id, start_seed:nil, no_of_records:nil, filter:nil, custom_headers:nil)
      get_video_frames_async(team_name, review_id, start_seed:start_seed, no_of_records:no_of_records, filter:filter, custom_headers:custom_headers).value!
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param start_seed [Integer] Time stamp of the frame from where you want to
    # start fetching the frames.
    # @param no_of_records [Integer] Number of frames to fetch.
    # @param filter [String] Get frames filtered by tags.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def get_video_frames_async(team_name, review_id, start_seed:nil, no_of_records:nil, filter:nil, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'review_id is nil' if review_id.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name,'reviewId' => review_id},
          query_params: {'startSeed' => start_seed,'noOfRecords' => no_of_records,'filter' => filter},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::CognitiveServices::ContentModerator::V1_0::Models::Frames.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Publish video review to make it available for review.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def publish_video_review(team_name, review_id, custom_headers:nil)
      response = publish_video_review_async(team_name, review_id, custom_headers:custom_headers).value!
      nil
    end

    #
    # Publish video review to make it available for review.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def publish_video_review_with_http_info(team_name, review_id, custom_headers:nil)
      publish_video_review_async(team_name, review_id, custom_headers:custom_headers).value!
    end

    #
    # Publish video review to make it available for review.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def publish_video_review_async(team_name, review_id, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'review_id is nil' if review_id.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/publish'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name,'reviewId' => review_id},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:post, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 204
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # This API adds a transcript screen text result file for a video review.
    # Transcript screen text result file is a result of Screen Text API . In order
    # to generate transcript screen text result file , a transcript file has to be
    # screened for profanity using Screen Text API.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param transcript_moderation_body [Array<TranscriptModerationBodyItem>] Body
    # for add video transcript moderation result API
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def add_video_transcript_moderation_result(content_type, team_name, review_id, transcript_moderation_body, custom_headers:nil)
      response = add_video_transcript_moderation_result_async(content_type, team_name, review_id, transcript_moderation_body, custom_headers:custom_headers).value!
      nil
    end

    #
    # This API adds a transcript screen text result file for a video review.
    # Transcript screen text result file is a result of Screen Text API . In order
    # to generate transcript screen text result file , a transcript file has to be
    # screened for profanity using Screen Text API.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param transcript_moderation_body [Array<TranscriptModerationBodyItem>] Body
    # for add video transcript moderation result API
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def add_video_transcript_moderation_result_with_http_info(content_type, team_name, review_id, transcript_moderation_body, custom_headers:nil)
      add_video_transcript_moderation_result_async(content_type, team_name, review_id, transcript_moderation_body, custom_headers:custom_headers).value!
    end

    #
    # This API adds a transcript screen text result file for a video review.
    # Transcript screen text result file is a result of Screen Text API . In order
    # to generate transcript screen text result file , a transcript file has to be
    # screened for profanity using Screen Text API.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param transcript_moderation_body [Array<TranscriptModerationBodyItem>] Body
    # for add video transcript moderation result API
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def add_video_transcript_moderation_result_async(content_type, team_name, review_id, transcript_moderation_body, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'content_type is nil' if content_type.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'review_id is nil' if review_id.nil?
      fail ArgumentError, 'transcript_moderation_body is nil' if transcript_moderation_body.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['Content-Type'] = content_type unless content_type.nil?
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = {
        client_side_validation: true,
        required: true,
        serialized_name: 'transcriptModerationBody',
        type: {
          name: 'Sequence',
          element: {
              client_side_validation: true,
              required: false,
              serialized_name: 'TranscriptModerationBodyItemElementType',
              type: {
                name: 'Composite',
                class_name: 'TranscriptModerationBodyItem'
              }
          }
        }
      }
      request_content = @client.serialize(request_mapper,  transcript_moderation_body)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcriptmoderationresult'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name,'reviewId' => review_id},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:put, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 204
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # This API adds a transcript file (text version of all the words spoken in a
    # video) to a video review. The file should be a valid WebVTT format.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param vttfile Transcript file of the video.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def add_video_transcript(team_name, review_id, vttfile, custom_headers:nil)
      response = add_video_transcript_async(team_name, review_id, vttfile, custom_headers:custom_headers).value!
      nil
    end

    #
    # This API adds a transcript file (text version of all the words spoken in a
    # video) to a video review. The file should be a valid WebVTT format.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param vttfile Transcript file of the video.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def add_video_transcript_with_http_info(team_name, review_id, vttfile, custom_headers:nil)
      add_video_transcript_async(team_name, review_id, vttfile, custom_headers:custom_headers).value!
    end

    #
    # This API adds a transcript file (text version of all the words spoken in a
    # video) to a video review. The file should be a valid WebVTT format.
    #
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param vttfile Transcript file of the video.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def add_video_transcript_async(team_name, review_id, vttfile, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'review_id is nil' if review_id.nil?
      content_type = 'text/plain'
      fail ArgumentError, 'vttfile is nil' if vttfile.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'text/plain'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['Content-Type'] = content_type unless content_type.nil?
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = {
        client_side_validation: true,
        required: true,
        serialized_name: 'VTT file',
        type: {
          name: 'Stream'
        }
      }
      request_content = @client.serialize(request_mapper,  vttfile)

      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcript'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name,'reviewId' => review_id},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:put, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 204
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param create_video_reviews_body [Array<CreateVideoReviewsBodyItem>] Body for
    # create reviews API
    # @param sub_team [String] SubTeam of your team, you want to assign the created
    # review to.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array] operation results.
    #
    def create_video_reviews(content_type, team_name, create_video_reviews_body, sub_team:nil, custom_headers:nil)
      response = create_video_reviews_async(content_type, team_name, create_video_reviews_body, sub_team:sub_team, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param create_video_reviews_body [Array<CreateVideoReviewsBodyItem>] Body for
    # create reviews API
    # @param sub_team [String] SubTeam of your team, you want to assign the created
    # review to.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def create_video_reviews_with_http_info(content_type, team_name, create_video_reviews_body, sub_team:nil, custom_headers:nil)
      create_video_reviews_async(content_type, team_name, create_video_reviews_body, sub_team:sub_team, custom_headers:custom_headers).value!
    end

    #
    # The reviews created would show up for Reviewers on your team. As Reviewers
    # complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
    # the specified CallBackEndpoint.
    #
    # <h3>CallBack Schemas </h3>
    # <h4>Review Completion CallBack Sample</h4>
    # <p>
    # {<br/>
    # "ReviewId": "<Review Id>",<br/>
    # "ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
    # "ModifiedBy": "<Name of the Reviewer>",<br/>
    # "CallBackType": "Review",<br/>
    # "ContentId": "<The ContentId that was specified input>",<br/>
    # "Metadata": {<br/>
    # "adultscore": "0.xxx",<br/>
    # "a": "False",<br/>
    # "racyscore": "0.xxx",<br/>
    # "r": "True"<br/>
    # },<br/>
    # "ReviewerResultTags": {<br/>
    # "a": "False",<br/>
    # "r": "True"<br/>
    # }<br/>
    # }<br/>
    #
    # </p>.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param create_video_reviews_body [Array<CreateVideoReviewsBodyItem>] Body for
    # create reviews API
    # @param sub_team [String] SubTeam of your team, you want to assign the created
    # review to.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def create_video_reviews_async(content_type, team_name, create_video_reviews_body, sub_team:nil, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'content_type is nil' if content_type.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'create_video_reviews_body is nil' if create_video_reviews_body.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['Content-Type'] = content_type unless content_type.nil?
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = {
        client_side_validation: true,
        required: true,
        serialized_name: 'CreateVideoReviewsBody',
        type: {
          name: 'Sequence',
          element: {
              client_side_validation: true,
              required: false,
              serialized_name: 'CreateVideoReviewsBodyItemElementType',
              type: {
                name: 'Composite',
                class_name: 'CreateVideoReviewsBodyItem'
              }
          }
        }
      }
      request_content = @client.serialize(request_mapper,  create_video_reviews_body)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name},
          query_params: {'subTeam' => sub_team},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:post, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = {
              client_side_validation: true,
              required: false,
              serialized_name: 'parsed_response',
              type: {
                name: 'Sequence',
                element: {
                    client_side_validation: true,
                    required: false,
                    serialized_name: 'StringElementType',
                    type: {
                      name: 'String'
                    }
                }
              }
            }
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Use this method to add frames for a video review.Timescale: This parameter is
    # a factor which is used to convert the timestamp on a frame into milliseconds.
    # Timescale is provided in the output of the Content Moderator video media
    # processor on the Azure Media Services platform.Timescale in the Video
    # Moderation output is Ticks/Second.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param video_frame_body [Array<VideoFrameBodyItem>] Body for add video frames
    # API
    # @param timescale [Integer] Timescale of the video.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def add_video_frame_url(content_type, team_name, review_id, video_frame_body, timescale:nil, custom_headers:nil)
      response = add_video_frame_url_async(content_type, team_name, review_id, video_frame_body, timescale:timescale, custom_headers:custom_headers).value!
      nil
    end

    #
    # Use this method to add frames for a video review.Timescale: This parameter is
    # a factor which is used to convert the timestamp on a frame into milliseconds.
    # Timescale is provided in the output of the Content Moderator video media
    # processor on the Azure Media Services platform.Timescale in the Video
    # Moderation output is Ticks/Second.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param video_frame_body [Array<VideoFrameBodyItem>] Body for add video frames
    # API
    # @param timescale [Integer] Timescale of the video.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def add_video_frame_url_with_http_info(content_type, team_name, review_id, video_frame_body, timescale:nil, custom_headers:nil)
      add_video_frame_url_async(content_type, team_name, review_id, video_frame_body, timescale:timescale, custom_headers:custom_headers).value!
    end

    #
    # Use this method to add frames for a video review.Timescale: This parameter is
    # a factor which is used to convert the timestamp on a frame into milliseconds.
    # Timescale is provided in the output of the Content Moderator video media
    # processor on the Azure Media Services platform.Timescale in the Video
    # Moderation output is Ticks/Second.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param video_frame_body [Array<VideoFrameBodyItem>] Body for add video frames
    # API
    # @param timescale [Integer] Timescale of the video.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def add_video_frame_url_async(content_type, team_name, review_id, video_frame_body, timescale:nil, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'content_type is nil' if content_type.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'review_id is nil' if review_id.nil?
      fail ArgumentError, 'video_frame_body is nil' if video_frame_body.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['Content-Type'] = content_type unless content_type.nil?
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = {
        client_side_validation: true,
        required: true,
        serialized_name: 'videoFrameBody',
        type: {
          name: 'Sequence',
          element: {
              client_side_validation: true,
              required: false,
              serialized_name: 'VideoFrameBodyItemElementType',
              type: {
                name: 'Composite',
                class_name: 'VideoFrameBodyItem'
              }
          }
        }
      }
      request_content = @client.serialize(request_mapper,  video_frame_body)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name,'reviewId' => review_id},
          query_params: {'timescale' => timescale},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:post, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 204
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Use this method to add frames for a video review.Timescale: This parameter is
    # a factor which is used to convert the timestamp on a frame into milliseconds.
    # Timescale is provided in the output of the Content Moderator video media
    # processor on the Azure Media Services platform.Timescale in the Video
    # Moderation output is Ticks/Second.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param frame_image_zip Zip file containing frame images.
    # @param frame_metadata [String] Metadata of the frame.
    # @param timescale [Integer] Timescale of the video .
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def add_video_frame_stream(content_type, team_name, review_id, frame_image_zip, frame_metadata, timescale:nil, custom_headers:nil)
      response = add_video_frame_stream_async(content_type, team_name, review_id, frame_image_zip, frame_metadata, timescale:timescale, custom_headers:custom_headers).value!
      nil
    end

    #
    # Use this method to add frames for a video review.Timescale: This parameter is
    # a factor which is used to convert the timestamp on a frame into milliseconds.
    # Timescale is provided in the output of the Content Moderator video media
    # processor on the Azure Media Services platform.Timescale in the Video
    # Moderation output is Ticks/Second.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param frame_image_zip Zip file containing frame images.
    # @param frame_metadata [String] Metadata of the frame.
    # @param timescale [Integer] Timescale of the video .
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def add_video_frame_stream_with_http_info(content_type, team_name, review_id, frame_image_zip, frame_metadata, timescale:nil, custom_headers:nil)
      add_video_frame_stream_async(content_type, team_name, review_id, frame_image_zip, frame_metadata, timescale:timescale, custom_headers:custom_headers).value!
    end

    #
    # Use this method to add frames for a video review.Timescale: This parameter is
    # a factor which is used to convert the timestamp on a frame into milliseconds.
    # Timescale is provided in the output of the Content Moderator video media
    # processor on the Azure Media Services platform.Timescale in the Video
    # Moderation output is Ticks/Second.
    #
    # @param content_type [String] The content type.
    # @param team_name [String] Your team name.
    # @param review_id [String] Id of the review.
    # @param frame_image_zip Zip file containing frame images.
    # @param frame_metadata [String] Metadata of the frame.
    # @param timescale [Integer] Timescale of the video .
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def add_video_frame_stream_async(content_type, team_name, review_id, frame_image_zip, frame_metadata, timescale:nil, custom_headers:nil)
      fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
      fail ArgumentError, 'content_type is nil' if content_type.nil?
      fail ArgumentError, 'team_name is nil' if team_name.nil?
      fail ArgumentError, 'review_id is nil' if review_id.nil?
      fail ArgumentError, 'frame_image_zip is nil' if frame_image_zip.nil?
      fail ArgumentError, 'frame_metadata is nil' if frame_metadata.nil?


      request_headers = {}
      request_headers['Content-Type'] = 'multipart/form-data'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['Content-Type'] = content_type unless content_type.nil?
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Set Form Data
      form_data = {}
      form_data['frameImageZip'] = frame_image_zip.to_s unless frame_image_zip.to_s.nil?
      form_data['frameMetadata'] = frame_metadata unless frame_metadata.nil?

      path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'

      request_url = @base_url || @client.base_url
    request_url = request_url.gsub('{Endpoint}', @client.endpoint)

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'teamName' => team_name,'reviewId' => review_id},
          query_params: {'timescale' => timescale},
          headers: request_headers.merge(custom_headers || {}),
          body: URI.encode_www_form(form_data),
          base_url: request_url
      }
      promise = @client.make_request_async(:post, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 204
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

        result
      end

      promise.execute
    end

  end
end
