/**
 * Kinow API
 * Client API for Kinow back-office
 *
 * OpenAPI spec version: 1.3.77
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 *
 * Swagger Codegen version: 
 *
 * Do not edit the class manually.
 *
 */

(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['ApiClient', 'model/Subtitle', 'model/CreateVideoSubtitleRequest', 'model/Video', 'model/Player', 'model/VideoSubtitlesResponse', 'model/VideoIDList', 'model/VideoAccessInfo', 'model/Subscriptions', 'model/Bonus', 'model/Image', 'model/DownloadInformations', 'model/Features', 'model/Geolocs', 'model/Player1', 'model/VideoViews', 'model/Videos2', 'model/Videos'], factory);
  } else if (typeof module === 'object' && module.exports) {
    // CommonJS-like environments that support module.exports, like Node.
    module.exports = factory(require('../ApiClient'), require('../model/Subtitle'), require('../model/CreateVideoSubtitleRequest'), require('../model/Video'), require('../model/Player'), require('../model/VideoSubtitlesResponse'), require('../model/VideoIDList'), require('../model/VideoAccessInfo'), require('../model/Subscriptions'), require('../model/Bonus'), require('../model/Image'), require('../model/DownloadInformations'), require('../model/Features'), require('../model/Geolocs'), require('../model/Player1'), require('../model/VideoViews'), require('../model/Videos2'), require('../model/Videos'));
  } else {
    // Browser globals (root is window)
    if (!root.KinowJavascriptSdk) {
      root.KinowJavascriptSdk = {};
    }
    root.KinowJavascriptSdk.VideosApi = factory(root.KinowJavascriptSdk.ApiClient, root.KinowJavascriptSdk.Subtitle, root.KinowJavascriptSdk.CreateVideoSubtitleRequest, root.KinowJavascriptSdk.Video, root.KinowJavascriptSdk.Player, root.KinowJavascriptSdk.VideoSubtitlesResponse, root.KinowJavascriptSdk.VideoIDList, root.KinowJavascriptSdk.VideoAccessInfo, root.KinowJavascriptSdk.Subscriptions, root.KinowJavascriptSdk.Bonus, root.KinowJavascriptSdk.Image, root.KinowJavascriptSdk.DownloadInformations, root.KinowJavascriptSdk.Features, root.KinowJavascriptSdk.Geolocs, root.KinowJavascriptSdk.Player1, root.KinowJavascriptSdk.VideoViews, root.KinowJavascriptSdk.Videos2, root.KinowJavascriptSdk.Videos);
  }
}(this, function(ApiClient, Subtitle, CreateVideoSubtitleRequest, Video, Player, VideoSubtitlesResponse, VideoIDList, VideoAccessInfo, Subscriptions, Bonus, Image, DownloadInformations, Features, Geolocs, Player1, VideoViews, Videos2, Videos) {
  'use strict';

  /**
   * Videos service.
   * @module api/VideosApi
   * @version 1.3.77
   */

  /**
   * Constructs a new VideosApi. 
   * @alias module:api/VideosApi
   * @class
   * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
   * default to {@link module:ApiClient#instance} if unspecified.
   */
  var exports = function(apiClient) {
    this.apiClient = apiClient || ApiClient.instance;



    /**
     * Attach cover to video (the image need to be attached to the product)
     * @param {Integer} videoId Video ID to fetch
     * @param {Integer} idImage Image ID to attach
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    this.attachCoverToVideoWithHttpInfo = function(videoId, idImage) {
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling attachCoverToVideo");
      }

      // verify the required parameter 'idImage' is set
      if (idImage === undefined || idImage === null) {
        throw new Error("Missing the required parameter 'idImage' when calling attachCoverToVideo");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
        'id_image': idImage
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = null;

      return this.apiClient.callApi(
        '/videos/{video_id}/cover', 'POST',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Attach cover to video (the image need to be attached to the product)
     * @param {Integer} videoId Video ID to fetch
     * @param {Integer} idImage Image ID to attach
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    this.attachCoverToVideo = function(videoId, idImage) {
      return this.attachCoverToVideoWithHttpInfo(videoId, idImage)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Attach feature to video
     * @param {Integer} videoId 
     * @param {String} features       To attach existing FeatureValue to Product:      &#x60;&#x60;&#x60;      [{      \&quot;id_feature\&quot;:3,      \&quot;id_feature_value\&quot;:5      }]      &#x60;&#x60;&#x60;        To create a custom FeatureValue:      &#x60;&#x60;&#x60;      [{      \&quot;id_feature\&quot;:3,      \&quot;custom_value\&quot;:[{      \&quot;lang\&quot;: 1,      \&quot;value\&quot;: \&quot;string\&quot;      }]      }]      &#x60;&#x60;&#x60;
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    this.attachFeaturesToVideoWithHttpInfo = function(videoId, features) {
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling attachFeaturesToVideo");
      }

      // verify the required parameter 'features' is set
      if (features === undefined || features === null) {
        throw new Error("Missing the required parameter 'features' when calling attachFeaturesToVideo");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
        'features': features
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = null;

      return this.apiClient.callApi(
        '/videos/{video_id}/features', 'POST',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Attach feature to video
     * @param {Integer} videoId 
     * @param {String} features       To attach existing FeatureValue to Product:      &#x60;&#x60;&#x60;      [{      \&quot;id_feature\&quot;:3,      \&quot;id_feature_value\&quot;:5      }]      &#x60;&#x60;&#x60;        To create a custom FeatureValue:      &#x60;&#x60;&#x60;      [{      \&quot;id_feature\&quot;:3,      \&quot;custom_value\&quot;:[{      \&quot;lang\&quot;: 1,      \&quot;value\&quot;: \&quot;string\&quot;      }]      }]      &#x60;&#x60;&#x60;
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    this.attachFeaturesToVideo = function(videoId, features) {
      return this.attachFeaturesToVideoWithHttpInfo(videoId, features)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Attach video to product
     * @param {Integer} productId Product ID to fetch
     * @param {Integer} videoId Video ID to attach
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    this.attachVideoToProductWithHttpInfo = function(productId, videoId) {
      var postBody = null;

      // verify the required parameter 'productId' is set
      if (productId === undefined || productId === null) {
        throw new Error("Missing the required parameter 'productId' when calling attachVideoToProduct");
      }

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling attachVideoToProduct");
      }


      var pathParams = {
        'product_id': productId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
        'video_id': videoId
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = null;

      return this.apiClient.callApi(
        '/products/{product_id}/videos', 'POST',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Attach video to product
     * @param {Integer} productId Product ID to fetch
     * @param {Integer} videoId Video ID to attach
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    this.attachVideoToProduct = function(productId, videoId) {
      return this.attachVideoToProductWithHttpInfo(productId, videoId)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Create new Video Subtitle
     * @param {Integer} videoId Video ID to attach the created Subtitle
     * @param {module:model/CreateVideoSubtitleRequest} body Subtitle settings
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Subtitle} and HTTP response
     */
    this.createSubtitleWithHttpInfo = function(videoId, body) {
      var postBody = body;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling createSubtitle");
      }

      // verify the required parameter 'body' is set
      if (body === undefined || body === null) {
        throw new Error("Missing the required parameter 'body' when calling createSubtitle");
      }


      var pathParams = {
      };
      var queryParams = {
        'video_id': videoId,
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Subtitle;

      return this.apiClient.callApi(
        '/videos/{video_id}/subtitle', 'POST',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Create new Video Subtitle
     * @param {Integer} videoId Video ID to attach the created Subtitle
     * @param {module:model/CreateVideoSubtitleRequest} body Subtitle settings
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Subtitle}
     */
    this.createSubtitle = function(videoId, body) {
      return this.createSubtitleWithHttpInfo(videoId, body)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Create new video
     * @param {module:model/Video} body 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Video} and HTTP response
     */
    this.createVideoWithHttpInfo = function(body) {
      var postBody = body;

      // verify the required parameter 'body' is set
      if (body === undefined || body === null) {
        throw new Error("Missing the required parameter 'body' when calling createVideo");
      }


      var pathParams = {
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Video;

      return this.apiClient.callApi(
        '/videos', 'POST',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Create new video
     * @param {module:model/Video} body 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Video}
     */
    this.createVideo = function(body) {
      return this.createVideoWithHttpInfo(body)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Delete video
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    this.deleteVideoWithHttpInfo = function(videoId) {
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling deleteVideo");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = null;

      return this.apiClient.callApi(
        '/videos/{video_id}', 'DELETE',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Delete video
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    this.deleteVideo = function(videoId) {
      return this.deleteVideoWithHttpInfo(videoId)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get video player
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.customerId Customer ID to fetch
     * @param {Integer} opts.countryId Country ID to use in video analytics
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Player} and HTTP response
     */
    this.getCategoryVideoPlayerWithHttpInfo = function(videoId, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getCategoryVideoPlayer");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
        'customer_id': opts['customerId'],
        'country_id': opts['countryId'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Player;

      return this.apiClient.callApi(
        '/categories/videos/{video_id}/player', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get video player
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.customerId Customer ID to fetch
     * @param {Integer} opts.countryId Country ID to use in video analytics
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Player}
     */
    this.getCategoryVideoPlayer = function(videoId, opts) {
      return this.getCategoryVideoPlayerWithHttpInfo(videoId, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get subtitles of a video
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/VideoSubtitlesResponse} and HTTP response
     */
    this.getCategoryVideoSubtitlesWithHttpInfo = function(videoId, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getCategoryVideoSubtitles");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
        'page': opts['page'],
        'per_page': opts['perPage'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = VideoSubtitlesResponse;

      return this.apiClient.callApi(
        '/categories/videos/{video_id}/subtitles', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get subtitles of a video
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/VideoSubtitlesResponse}
     */
    this.getCategoryVideoSubtitles = function(videoId, opts) {
      return this.getCategoryVideoSubtitlesWithHttpInfo(videoId, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get customer access to video
     * @param {Integer} customerId Customer ID to fetch
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    this.getCustomerHasAccessToVideoWithHttpInfo = function(customerId, videoId) {
      var postBody = null;

      // verify the required parameter 'customerId' is set
      if (customerId === undefined || customerId === null) {
        throw new Error("Missing the required parameter 'customerId' when calling getCustomerHasAccessToVideo");
      }

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getCustomerHasAccessToVideo");
      }


      var pathParams = {
        'customer_id': customerId,
        'video_id': videoId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = null;

      return this.apiClient.callApi(
        '/customers/{customer_id}/videos/{video_id}/has-access', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get customer access to video
     * @param {Integer} customerId Customer ID to fetch
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    this.getCustomerHasAccessToVideo = function(customerId, videoId) {
      return this.getCustomerHasAccessToVideoWithHttpInfo(customerId, videoId)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get customer access to Videos
     * @param {Integer} customerId Customer ID to fetch
     * @param {module:model/VideoIDList} body List of Video IDs separated by comma, eg. &#39;42,21,84&#39;
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/VideoAccessInfo>} and HTTP response
     */
    this.getCustomerHasAccessToVideosWithHttpInfo = function(customerId, body) {
      var postBody = body;

      // verify the required parameter 'customerId' is set
      if (customerId === undefined || customerId === null) {
        throw new Error("Missing the required parameter 'customerId' when calling getCustomerHasAccessToVideos");
      }

      // verify the required parameter 'body' is set
      if (body === undefined || body === null) {
        throw new Error("Missing the required parameter 'body' when calling getCustomerHasAccessToVideos");
      }


      var pathParams = {
        'customer_id': customerId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = [VideoAccessInfo];

      return this.apiClient.callApi(
        '/customers/{customer_id}/videos/has-access', 'POST',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get customer access to Videos
     * @param {Integer} customerId Customer ID to fetch
     * @param {module:model/VideoIDList} body List of Video IDs separated by comma, eg. &#39;42,21,84&#39;
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/VideoAccessInfo>}
     */
    this.getCustomerHasAccessToVideos = function(customerId, body) {
      return this.getCustomerHasAccessToVideosWithHttpInfo(customerId, body)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get disabled subscriptions list
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Subscriptions} and HTTP response
     */
    this.getDisabledSubscriptionsWithHttpInfo = function(videoId, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getDisabledSubscriptions");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
        'page': opts['page'],
        'per_page': opts['perPage'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Subscriptions;

      return this.apiClient.callApi(
        '/videos/{video_id}/disabled-subscriptions', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get disabled subscriptions list
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Subscriptions}
     */
    this.getDisabledSubscriptions = function(videoId, opts) {
      return this.getDisabledSubscriptionsWithHttpInfo(videoId, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get video
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Video} and HTTP response
     */
    this.getVideoWithHttpInfo = function(videoId) {
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getVideo");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Video;

      return this.apiClient.callApi(
        '/videos/{video_id}', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get video
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Video}
     */
    this.getVideo = function(videoId) {
      return this.getVideoWithHttpInfo(videoId)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get video access
     * @param {Integer} videoId Video ID to fetch
     * @param {Integer} customerId Customer ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    this.getVideoAccessWithHttpInfo = function(videoId, customerId) {
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getVideoAccess");
      }

      // verify the required parameter 'customerId' is set
      if (customerId === undefined || customerId === null) {
        throw new Error("Missing the required parameter 'customerId' when calling getVideoAccess");
      }


      var pathParams = {
        'video_id': videoId,
        'customer_id': customerId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = null;

      return this.apiClient.callApi(
        '/videos/{video_id}/customers/{customer_id}/access', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get video access
     * @param {Integer} videoId Video ID to fetch
     * @param {Integer} customerId Customer ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    this.getVideoAccess = function(videoId, customerId) {
      return this.getVideoAccessWithHttpInfo(videoId, customerId)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get bonus list
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/Bonus>} and HTTP response
     */
    this.getVideoBonusWithHttpInfo = function(videoId) {
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getVideoBonus");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = [Bonus];

      return this.apiClient.callApi(
        '/videos/{video_id}/bonus', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get bonus list
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/Bonus>}
     */
    this.getVideoBonus = function(videoId) {
      return this.getVideoBonusWithHttpInfo(videoId)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get video cover
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Image} and HTTP response
     */
    this.getVideoCoverWithHttpInfo = function(videoId) {
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getVideoCover");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Image;

      return this.apiClient.callApi(
        '/videos/{video_id}/cover', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get video cover
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Image}
     */
    this.getVideoCover = function(videoId) {
      return this.getVideoCoverWithHttpInfo(videoId)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get video download informations
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.customerId Customer ID to fetch
     * @param {String} opts.ipAddress IP address
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DownloadInformations} and HTTP response
     */
    this.getVideoDownloadUrlWithHttpInfo = function(videoId, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getVideoDownloadUrl");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
        'customer_id': opts['customerId'],
        'ip_address': opts['ipAddress'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = DownloadInformations;

      return this.apiClient.callApi(
        '/videos/{video_id}/download-url', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get video download informations
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.customerId Customer ID to fetch
     * @param {String} opts.ipAddress IP address
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DownloadInformations}
     */
    this.getVideoDownloadUrl = function(videoId, opts) {
      return this.getVideoDownloadUrlWithHttpInfo(videoId, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get video features
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Features} and HTTP response
     */
    this.getVideoFeaturesWithHttpInfo = function(videoId, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getVideoFeatures");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
        'page': opts['page'],
        'per_page': opts['perPage'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Features;

      return this.apiClient.callApi(
        '/videos/{video_id}/features', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get video features
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Features}
     */
    this.getVideoFeatures = function(videoId, opts) {
      return this.getVideoFeaturesWithHttpInfo(videoId, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get geoloc list
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Geolocs} and HTTP response
     */
    this.getVideoGeolocationWithHttpInfo = function(videoId, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getVideoGeolocation");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
        'page': opts['page'],
        'per_page': opts['perPage'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Geolocs;

      return this.apiClient.callApi(
        '/videos/{video_id}/geolocation', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get geoloc list
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Geolocs}
     */
    this.getVideoGeolocation = function(videoId, opts) {
      return this.getVideoGeolocationWithHttpInfo(videoId, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Check access to a video by geolocation
     * @param {Integer} videoId Video ID to fetch
     * @param {String} ipAddress IP address
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    this.getVideoGeolocationByIpWithHttpInfo = function(videoId, ipAddress, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getVideoGeolocationByIp");
      }

      // verify the required parameter 'ipAddress' is set
      if (ipAddress === undefined || ipAddress === null) {
        throw new Error("Missing the required parameter 'ipAddress' when calling getVideoGeolocationByIp");
      }


      var pathParams = {
        'video_id': videoId,
        'ip_address': ipAddress
      };
      var queryParams = {
        'page': opts['page'],
        'per_page': opts['perPage'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = null;

      return this.apiClient.callApi(
        '/videos/{video_id}/geolocations/{ip_address}', 'POST',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Check access to a video by geolocation
     * @param {Integer} videoId Video ID to fetch
     * @param {String} ipAddress IP address
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    this.getVideoGeolocationByIp = function(videoId, ipAddress, opts) {
      return this.getVideoGeolocationByIpWithHttpInfo(videoId, ipAddress, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get video player
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.customerId Customer ID to fetch
     * @param {Integer} opts.countryId Country ID to use in video analytics
     * @param {String} opts.ipAddress IP address
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Player1} and HTTP response
     */
    this.getVideoPlayerWithHttpInfo = function(videoId, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getVideoPlayer");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
        'customer_id': opts['customerId'],
        'country_id': opts['countryId'],
        'ip_address': opts['ipAddress'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Player1;

      return this.apiClient.callApi(
        '/videos/{video_id}/player', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get video player
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.customerId Customer ID to fetch
     * @param {Integer} opts.countryId Country ID to use in video analytics
     * @param {String} opts.ipAddress IP address
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Player1}
     */
    this.getVideoPlayer = function(videoId, opts) {
      return this.getVideoPlayerWithHttpInfo(videoId, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get subtitles of a video
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/VideoSubtitlesResponse} and HTTP response
     */
    this.getVideoSubtitlesWithHttpInfo = function(videoId, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getVideoSubtitles");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
        'page': opts['page'],
        'per_page': opts['perPage'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = VideoSubtitlesResponse;

      return this.apiClient.callApi(
        '/videos/{video_id}/subtitles', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get subtitles of a video
     * @param {Integer} videoId Video ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/VideoSubtitlesResponse}
     */
    this.getVideoSubtitles = function(videoId, opts) {
      return this.getVideoSubtitlesWithHttpInfo(videoId, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get video views
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/VideoViews} and HTTP response
     */
    this.getVideoViewsWithHttpInfo = function(videoId) {
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling getVideoViews");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = VideoViews;

      return this.apiClient.callApi(
        '/videos/{video_id}/views', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get video views
     * @param {Integer} videoId Video ID to fetch
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/VideoViews}
     */
    this.getVideoViews = function(videoId) {
      return this.getVideoViewsWithHttpInfo(videoId)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get video list
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @param {String} opts.features       &#x60;&#x60;&#x60;      features[*][value]&#x3D;string&amp;features[*][operator]&#x3D;strict&amp;features[1][value]&#x3D;string&amp;features[1][operator]&#x3D;strict      _______________        {      \&quot;*\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;strict\&quot;      },      \&quot;1\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;contains\&quot;      }      } &#x60;&#x60;&#x60;      Operator can be strict, contains, gt or lt.      To search on all features, you can pass * as featureId.
     * @param {String} opts.filters       &#x60;&#x60;&#x60;      name[value]&#x3D;string&amp;name[operator]&#x3D;strict&amp;duration[value]&#x3D;string&amp;duration[operator]&#x3D;gt      _______________        {      \&quot;name\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;strict\&quot;      },      \&quot;duration\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;gt\&quot;      }      } &#x60;&#x60;&#x60;      Operator can be strict, contains, gt or lt.
     * @param {String} opts.ip filter by customer ip
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Videos2} and HTTP response
     */
    this.getVideosWithHttpInfo = function(opts) {
      opts = opts || {};
      var postBody = null;


      var pathParams = {
      };
      var queryParams = {
        'page': opts['page'],
        'per_page': opts['perPage'],
        'features': opts['features'],
        'filters': opts['filters'],
        'ip': opts['ip'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Videos2;

      return this.apiClient.callApi(
        '/videos', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get video list
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @param {String} opts.features       &#x60;&#x60;&#x60;      features[*][value]&#x3D;string&amp;features[*][operator]&#x3D;strict&amp;features[1][value]&#x3D;string&amp;features[1][operator]&#x3D;strict      _______________        {      \&quot;*\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;strict\&quot;      },      \&quot;1\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;contains\&quot;      }      } &#x60;&#x60;&#x60;      Operator can be strict, contains, gt or lt.      To search on all features, you can pass * as featureId.
     * @param {String} opts.filters       &#x60;&#x60;&#x60;      name[value]&#x3D;string&amp;name[operator]&#x3D;strict&amp;duration[value]&#x3D;string&amp;duration[operator]&#x3D;gt      _______________        {      \&quot;name\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;strict\&quot;      },      \&quot;duration\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;gt\&quot;      }      } &#x60;&#x60;&#x60;      Operator can be strict, contains, gt or lt.
     * @param {String} opts.ip filter by customer ip
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Videos2}
     */
    this.getVideos = function(opts) {
      return this.getVideosWithHttpInfo(opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get Videos attached to Categories
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @param {String} opts.sortBy Sort by this attribute (id by default)
     * @param {module:model/String} opts.sortDirection Sorting direction (asc by default)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Videos} and HTTP response
     */
    this.getVideosFromCategoriesWithHttpInfo = function(opts) {
      opts = opts || {};
      var postBody = null;


      var pathParams = {
      };
      var queryParams = {
        'page': opts['page'],
        'per_page': opts['perPage'],
        'sort_by': opts['sortBy'],
        'sort_direction': opts['sortDirection'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Videos;

      return this.apiClient.callApi(
        '/categories/videos', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get Videos attached to Categories
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @param {String} opts.sortBy Sort by this attribute (id by default)
     * @param {module:model/String} opts.sortDirection Sorting direction (asc by default)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Videos}
     */
    this.getVideosFromCategories = function(opts) {
      return this.getVideosFromCategoriesWithHttpInfo(opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get Videos attached to Category
     * @param {Integer} categoryId Category ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @param {String} opts.sortBy Sort by this attribute (id by default)
     * @param {module:model/String} opts.sortDirection Sorting direction (asc by default)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Videos} and HTTP response
     */
    this.getVideosFromCategoryWithHttpInfo = function(categoryId, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'categoryId' is set
      if (categoryId === undefined || categoryId === null) {
        throw new Error("Missing the required parameter 'categoryId' when calling getVideosFromCategory");
      }


      var pathParams = {
        'category_id': categoryId
      };
      var queryParams = {
        'page': opts['page'],
        'per_page': opts['perPage'],
        'sort_by': opts['sortBy'],
        'sort_direction': opts['sortDirection'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Videos;

      return this.apiClient.callApi(
        '/categories/{category_id}/videos', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get Videos attached to Category
     * @param {Integer} categoryId Category ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {Integer} opts.perPage 
     * @param {String} opts.sortBy Sort by this attribute (id by default)
     * @param {module:model/String} opts.sortDirection Sorting direction (asc by default)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Videos}
     */
    this.getVideosFromCategory = function(categoryId, opts) {
      return this.getVideosFromCategoryWithHttpInfo(categoryId, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Get videos attached to product
     * @param {Integer} productId Product ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {String} opts.filters       &#x60;&#x60;&#x60;      name[value]&#x3D;string&amp;name[operator]&#x3D;strict&amp;duration[value]&#x3D;string&amp;duration[operator]&#x3D;gt      _______________        {      \&quot;name\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;strict\&quot;      },      \&quot;duration\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;gt\&quot;      }      } &#x60;&#x60;&#x60;      Operator can be strict, contains, gt or lt.
     * @param {Integer} opts.perPage 
     * @param {String} opts.ip filter by customer ip
     * @param {String} opts.sortBy Sort by this attribute (id by default)
     * @param {module:model/String} opts.sortDirection Sorting direction (asc by default)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Videos2} and HTTP response
     */
    this.getVideosFromProductWithHttpInfo = function(productId, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'productId' is set
      if (productId === undefined || productId === null) {
        throw new Error("Missing the required parameter 'productId' when calling getVideosFromProduct");
      }


      var pathParams = {
        'product_id': productId
      };
      var queryParams = {
        'page': opts['page'],
        'filters': opts['filters'],
        'per_page': opts['perPage'],
        'ip': opts['ip'],
        'sort_by': opts['sortBy'],
        'sort_direction': opts['sortDirection'],
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Videos2;

      return this.apiClient.callApi(
        '/products/{product_id}/videos', 'GET',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Get videos attached to product
     * @param {Integer} productId Product ID to fetch
     * @param {Object} opts Optional parameters
     * @param {Integer} opts.page 
     * @param {String} opts.filters       &#x60;&#x60;&#x60;      name[value]&#x3D;string&amp;name[operator]&#x3D;strict&amp;duration[value]&#x3D;string&amp;duration[operator]&#x3D;gt      _______________        {      \&quot;name\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;strict\&quot;      },      \&quot;duration\&quot;: {      \&quot;value\&quot;: \&quot;string\&quot;,      \&quot;operator\&quot;: \&quot;gt\&quot;      }      } &#x60;&#x60;&#x60;      Operator can be strict, contains, gt or lt.
     * @param {Integer} opts.perPage 
     * @param {String} opts.ip filter by customer ip
     * @param {String} opts.sortBy Sort by this attribute (id by default)
     * @param {module:model/String} opts.sortDirection Sorting direction (asc by default)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Videos2}
     */
    this.getVideosFromProduct = function(productId, opts) {
      return this.getVideosFromProductWithHttpInfo(productId, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Handle geolocation for videos by countries
     * @param {Integer} videoId Video ID to fetch
     * @param {Integer} enabled Enabled
     * @param {module:model/String} behaviorDetectedCountries Behavior for detected countries
     * @param {module:model/String} behaviorNonDetectedCountries Behavior for non-detected countries
     * @param {Object} opts Optional parameters
     * @param {String} opts.countries IDs of the non-detected countries separated by comma
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    this.setVideoGeolocationWithHttpInfo = function(videoId, enabled, behaviorDetectedCountries, behaviorNonDetectedCountries, opts) {
      opts = opts || {};
      var postBody = null;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling setVideoGeolocation");
      }

      // verify the required parameter 'enabled' is set
      if (enabled === undefined || enabled === null) {
        throw new Error("Missing the required parameter 'enabled' when calling setVideoGeolocation");
      }

      // verify the required parameter 'behaviorDetectedCountries' is set
      if (behaviorDetectedCountries === undefined || behaviorDetectedCountries === null) {
        throw new Error("Missing the required parameter 'behaviorDetectedCountries' when calling setVideoGeolocation");
      }

      // verify the required parameter 'behaviorNonDetectedCountries' is set
      if (behaviorNonDetectedCountries === undefined || behaviorNonDetectedCountries === null) {
        throw new Error("Missing the required parameter 'behaviorNonDetectedCountries' when calling setVideoGeolocation");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
        'countries': opts['countries'],
        'enabled': enabled,
        'behavior_detected_countries': behaviorDetectedCountries,
        'behavior_non_detected_countries': behaviorNonDetectedCountries
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = null;

      return this.apiClient.callApi(
        '/videos/{video_id}/geolocations', 'PUT',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Handle geolocation for videos by countries
     * @param {Integer} videoId Video ID to fetch
     * @param {Integer} enabled Enabled
     * @param {module:model/String} behaviorDetectedCountries Behavior for detected countries
     * @param {module:model/String} behaviorNonDetectedCountries Behavior for non-detected countries
     * @param {Object} opts Optional parameters
     * @param {String} opts.countries IDs of the non-detected countries separated by comma
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    this.setVideoGeolocation = function(videoId, enabled, behaviorDetectedCountries, behaviorNonDetectedCountries, opts) {
      return this.setVideoGeolocationWithHttpInfo(videoId, enabled, behaviorDetectedCountries, behaviorNonDetectedCountries, opts)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }


    /**
     * Update video
     * @param {Integer} videoId Video ID to update
     * @param {module:model/Video} body 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Video} and HTTP response
     */
    this.updateVideoWithHttpInfo = function(videoId, body) {
      var postBody = body;

      // verify the required parameter 'videoId' is set
      if (videoId === undefined || videoId === null) {
        throw new Error("Missing the required parameter 'videoId' when calling updateVideo");
      }

      // verify the required parameter 'body' is set
      if (body === undefined || body === null) {
        throw new Error("Missing the required parameter 'body' when calling updateVideo");
      }


      var pathParams = {
        'video_id': videoId
      };
      var queryParams = {
      };
      var collectionQueryParams = {
      };
      var headerParams = {
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = [];
      var returnType = Video;

      return this.apiClient.callApi(
        '/videos/{video_id}', 'PUT',
        pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType
      );
    }

    /**
     * Update video
     * @param {Integer} videoId Video ID to update
     * @param {module:model/Video} body 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Video}
     */
    this.updateVideo = function(videoId, body) {
      return this.updateVideoWithHttpInfo(videoId, body)
        .then(function(response_and_data) {
          return response_and_data;
        });
    }
  };

  return exports;
}));
