text: /**
  *  Copyright 2019 Adobe Systems Incorporated. All rights reserved.
  *  This file is licensed to you under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License. You may obtain a copy
  *  of the License at http://www.apache.org/licenses/LICENSE-2.0
  *
  *  Unless required by applicable law or agreed to in writing, software distributed under
  *  the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
  *  OF ANY KIND, either express or implied. See the License for the specific language
  *  governing permissions and limitations under the License.
  *
  *
  **/
  
  
  /**
   * 
   * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
   *
   * OpenAPI spec version: 6.0.0
   *
   * NOTE: This class is auto generated by the swagger code generator program.
   * https://github.com/swagger-api/swagger-codegen.git
   *
   * Swagger Codegen version: 2.3.1
   *
   * Do not edit the class manually.
   *
   */
  
  (function(root, factory) {
    if (typeof define === 'function' && define.amd) {
      // AMD. Register as an anonymous module.
      define(['model/ApiClient', 'model/webhooks/UserWebhooks', 'model/webhooks/WebhookCreationResponse', 'model/webhooks/WebhookInfo', 'model/webhooks/WebhookStateInfo'], factory);
    } else if (typeof module === 'object' && module.exports) {
      // CommonJS-like environments that support module.exports, like Node.
      module.exports = factory(require('../model/ApiClient'), require('../model/webhooks/UserWebhooks'), require('../model/webhooks/WebhookCreationResponse'), require('../model/webhooks/WebhookInfo'), require('../model/webhooks/WebhookStateInfo'));
    } else {
      // Browser globals (root is window)
      if (!root.SwaggerJsClient) {
        root.SwaggerJsClient = {};
      }
      root.SwaggerJsClient.WebhooksApi = factory(root.SwaggerJsClient.ApiClient, root.SwaggerJsClient.UserWebhooks, root.SwaggerJsClient.WebhookCreationResponse, root.SwaggerJsClient.WebhookInfo, root.SwaggerJsClient.WebhookStateInfo);
    }
  }(this, function(ApiClient, UserWebhooks, WebhookCreationResponse, WebhookInfo, WebhookStateInfo) {
    'use strict';
  
    /**
     * Webhooks service.
     * @module api/WebhooksApi
     * @version 6.0.0
     */
  
    /**
     * Constructs a new WebhooksApi. 
     * @alias module:api/WebhooksApi
     * @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;
  
  
  
      /**
       * Creates a webhook.
       * This is a primary endpoint which is used to create a new webhook. A webhook can only be created in ACTIVE state. Currently, webhooks are supported at four scopes - Account, Group, User and Resource. &lt;br/&gt; &lt;br/&gt; Before creating a webhook successfully at any of these scopes, Adobe Sign &lt;a href&#x3D;&#39;https://www.adobe.io/apis/documentcloud/sign/docs.html#!adobeio/adobeio-documentation/master/sign/webhooks.md#verificationofintentofthewebhookurl&#39;&gt;verifies&lt;/a&gt; that the webhook URL that is provided in the registration request really intends to receive notifications and is a valid URL. &lt;br/&gt;There is a defined mechanism for this validation where Adobe Sign makes an HTTPS GET request to the webhook URL. This request has a custom HTTP header X-AdobeSign-ClientId. The value of this header is the client ID of the application that is requesting to create the webhook. To register a webhook successfully, the webhook URL must respond to this verification request with an HTTPS 2XX response code, and also it must send back the same client ID value in one of the following two ways:&lt;ol&gt;&lt;li&gt;In a custom response header, X-AdobeSign-ClientId. This is the same header which was passed in the request, and can be echoed back in the response.&lt;/li&gt;&lt;li&gt; In the JSON response body of the response with the key of xAdobeSignClientId and its value being the same client ID that was sent in the request. &lt;/li&gt;&lt;/ol&gt;&lt;p&gt;On successful registration,  Adobe Sign sends a success response (any HTTPS 2XX code) to your client app with the unique webhook identifier and a Location header, which contains the URL of the webhook resource created in Adobe Sign.&lt;br/&gt; To learn more, please refer &lt;a href&#x3D;&#39;https://www.adobe.io/apis/documentcloud/sign/docs.html#!adobeio/adobeio-documentation/master/sign/webhooks.md&#39;&gt;Webhooks in Adobe Sign Guide&lt;/a&gt;.&lt;/p&gt;
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_write&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {module:model/webhooks/WebhookInfo} webhookInfo Information about the webhook that you want to create
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/webhooks/WebhookCreationResponse} and HTTP response
       */
      this.createWebhookWithHttpInfo = function(authorization, webhookInfo, opts) {
        opts = opts || {};
        var postBody = webhookInfo;
  
        // verify the required parameter 'authorization' is set
        if (authorization === undefined || authorization === null) {
          throw new Error("Missing the required parameter 'authorization' when calling createWebhook");
        }
  
        // verify the required parameter 'webhookInfo' is set
        if (webhookInfo === undefined || webhookInfo === null) {
          throw new Error("Missing the required parameter 'webhookInfo' when calling createWebhook");
        }
  
  
        var pathParams = {
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'Authorization': authorization,
          'x-api-user': opts['xApiUser'],
          'x-on-behalf-of-user': opts['xOnBehalfOfUser']
        };
        var formParams = {
        };
  
        var authNames = [];
        var contentTypes = [];
        var accepts = ['application/json'];
        var returnType = WebhookCreationResponse;
  
        return this.apiClient.callApi(
          '/webhooks', 'POST',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType
        );
      }
  
      /**
       * Creates a webhook.
       * This is a primary endpoint which is used to create a new webhook. A webhook can only be created in ACTIVE state. Currently, webhooks are supported at four scopes - Account, Group, User and Resource. &lt;br/&gt; &lt;br/&gt; Before creating a webhook successfully at any of these scopes, Adobe Sign &lt;a href&#x3D;&#39;https://www.adobe.io/apis/documentcloud/sign/docs.html#!adobeio/adobeio-documentation/master/sign/webhooks.md#verificationofintentofthewebhookurl&#39;&gt;verifies&lt;/a&gt; that the webhook URL that is provided in the registration request really intends to receive notifications and is a valid URL. &lt;br/&gt;There is a defined mechanism for this validation where Adobe Sign makes an HTTPS GET request to the webhook URL. This request has a custom HTTP header X-AdobeSign-ClientId. The value of this header is the client ID of the application that is requesting to create the webhook. To register a webhook successfully, the webhook URL must respond to this verification request with an HTTPS 2XX response code, and also it must send back the same client ID value in one of the following two ways:&lt;ol&gt;&lt;li&gt;In a custom response header, X-AdobeSign-ClientId. This is the same header which was passed in the request, and can be echoed back in the response.&lt;/li&gt;&lt;li&gt; In the JSON response body of the response with the key of xAdobeSignClientId and its value being the same client ID that was sent in the request. &lt;/li&gt;&lt;/ol&gt;&lt;p&gt;On successful registration,  Adobe Sign sends a success response (any HTTPS 2XX code) to your client app with the unique webhook identifier and a Location header, which contains the URL of the webhook resource created in Adobe Sign.&lt;br/&gt; To learn more, please refer &lt;a href&#x3D;&#39;https://www.adobe.io/apis/documentcloud/sign/docs.html#!adobeio/adobeio-documentation/master/sign/webhooks.md&#39;&gt;Webhooks in Adobe Sign Guide&lt;/a&gt;.&lt;/p&gt;
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_write&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {module:model/webhooks/WebhookInfo} webhookInfo Information about the webhook that you want to create
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/webhooks/WebhookCreationResponse}
       */
      this.createWebhook = function(authorization, webhookInfo, opts) {
        return this.createWebhookWithHttpInfo(authorization, webhookInfo, opts)
          .then(function(response_and_data) {
            return response_and_data.data;
          });
      }
  
  
      /**
       * Deletes a webhook.
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_retention&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_retention&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_retention&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {String} ifMatch The server will only update the resource if it matches the listed ETag otherwise error RESOURCE_MODIFIED(412) is returned.
       * @param {String} webhookId The webhook identifier, as returned by the webhook creation API or retrieved from the API to fetch webhooks.
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
       */
      this.deleteWebhookWithHttpInfo = function(authorization, ifMatch, webhookId, opts) {
        opts = opts || {};
        var postBody = null;
  
        // verify the required parameter 'authorization' is set
        if (authorization === undefined || authorization === null) {
          throw new Error("Missing the required parameter 'authorization' when calling deleteWebhook");
        }
  
        // verify the required parameter 'ifMatch' is set
        if (ifMatch === undefined || ifMatch === null) {
          throw new Error("Missing the required parameter 'ifMatch' when calling deleteWebhook");
        }
  
        // verify the required parameter 'webhookId' is set
        if (webhookId === undefined || webhookId === null) {
          throw new Error("Missing the required parameter 'webhookId' when calling deleteWebhook");
        }
  
  
        var pathParams = {
          'webhookId': webhookId
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'Authorization': authorization,
          'x-api-user': opts['xApiUser'],
          'x-on-behalf-of-user': opts['xOnBehalfOfUser'],
          'If-Match': ifMatch
        };
        var formParams = {
        };
  
        var authNames = [];
        var contentTypes = [];
        var accepts = ['application/json'];
        var returnType = null;
  
        return this.apiClient.callApi(
          '/webhooks/{webhookId}', 'DELETE',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType
        );
      }
  
      /**
       * Deletes a webhook.
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_retention&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_retention&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_retention&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {String} ifMatch The server will only update the resource if it matches the listed ETag otherwise error RESOURCE_MODIFIED(412) is returned.
       * @param {String} webhookId The webhook identifier, as returned by the webhook creation API or retrieved from the API to fetch webhooks.
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}
       */
      this.deleteWebhook = function(authorization, ifMatch, webhookId, opts) {
        return this.deleteWebhookWithHttpInfo(authorization, ifMatch, webhookId, opts)
          .then(function(response_and_data) {
            return response_and_data.data;
          });
      }
  
  
      /**
       * Retrieves the details of a webhook.
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_read&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_read&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_read&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {String} webhookId The webhook identifier, as returned by the webhook creation API or retrieved from the API to fetch webhooks.
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @param {String} opts.ifNoneMatch Pass the value of the e-tag header obtained from the previous response to the same request to get a RESOURCE_NOT_MODIFIED(304) if the resource hasn&#39;t changed.
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/webhooks/WebhookInfo} and HTTP response
       */
      this.getWebhookInfoWithHttpInfo = function(authorization, webhookId, opts) {
        opts = opts || {};
        var postBody = null;
  
        // verify the required parameter 'authorization' is set
        if (authorization === undefined || authorization === null) {
          throw new Error("Missing the required parameter 'authorization' when calling getWebhookInfo");
        }
  
        // verify the required parameter 'webhookId' is set
        if (webhookId === undefined || webhookId === null) {
          throw new Error("Missing the required parameter 'webhookId' when calling getWebhookInfo");
        }
  
  
        var pathParams = {
          'webhookId': webhookId
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'Authorization': authorization,
          'x-api-user': opts['xApiUser'],
          'x-on-behalf-of-user': opts['xOnBehalfOfUser'],
          'If-None-Match': opts['ifNoneMatch']
        };
        var formParams = {
        };
  
        var authNames = [];
        var contentTypes = [];
        var accepts = ['application/json'];
        var returnType = WebhookInfo;
  
        return this.apiClient.callApi(
          '/webhooks/{webhookId}', 'GET',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType
        );
      }
  
      /**
       * Retrieves the details of a webhook.
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_read&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_read&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_read&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {String} webhookId The webhook identifier, as returned by the webhook creation API or retrieved from the API to fetch webhooks.
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @param {String} opts.ifNoneMatch Pass the value of the e-tag header obtained from the previous response to the same request to get a RESOURCE_NOT_MODIFIED(304) if the resource hasn&#39;t changed.
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/webhooks/WebhookInfo}
       */
      this.getWebhookInfo = function(authorization, webhookId, opts) {
        return this.getWebhookInfoWithHttpInfo(authorization, webhookId, opts)
          .then(function(response_and_data) {
            return response_and_data.data;
          });
      }
  
  
      /**
       * Retrieves webhooks for a user.
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_read&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_read&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_read&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @param {Boolean} opts.showInActiveWebhooks A query parameter to fetch all the inactive webhooks along with the active webhooks.
       * @param {module:model/webhooks/String} opts.scope Scope of webhook. The possible values are ACCOUNT, GROUP, USER or RESOURCE
       * @param {module:model/webhooks/String} opts.resourceType The type of resource on which webhook was created. The possible values are AGREEMENT, WIDGET, MEGASIGN and LIBRARY_DOCUMENT.
       * @param {String} opts.cursor Used to navigate through the pages. If not provided, returns the first page.
       * @param {Number} opts.pageSize Number of intended items in the response page. If not provided, it is decided by the application settings.
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/webhooks/UserWebhooks} and HTTP response
       */
      this.getWebhooksWithHttpInfo = function(authorization, opts) {
        opts = opts || {};
        var postBody = null;
  
        // verify the required parameter 'authorization' is set
        if (authorization === undefined || authorization === null) {
          throw new Error("Missing the required parameter 'authorization' when calling getWebhooks");
        }
  
  
        var pathParams = {
        };
        var queryParams = {
          'showInActiveWebhooks': opts['showInActiveWebhooks'],
          'scope': opts['scope'],
          'resourceType': opts['resourceType'],
          'cursor': opts['cursor'],
          'pageSize': opts['pageSize'],
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'Authorization': authorization,
          'x-api-user': opts['xApiUser'],
          'x-on-behalf-of-user': opts['xOnBehalfOfUser']
        };
        var formParams = {
        };
  
        var authNames = [];
        var contentTypes = [];
        var accepts = ['application/json'];
        var returnType = UserWebhooks;
  
        return this.apiClient.callApi(
          '/webhooks', 'GET',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType
        );
      }
  
      /**
       * Retrieves webhooks for a user.
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_read&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_read&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_read&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @param {Boolean} opts.showInActiveWebhooks A query parameter to fetch all the inactive webhooks along with the active webhooks.
       * @param {module:model/webhooks/String} opts.scope Scope of webhook. The possible values are ACCOUNT, GROUP, USER or RESOURCE
       * @param {module:model/webhooks/String} opts.resourceType The type of resource on which webhook was created. The possible values are AGREEMENT, WIDGET, MEGASIGN and LIBRARY_DOCUMENT.
       * @param {String} opts.cursor Used to navigate through the pages. If not provided, returns the first page.
       * @param {Number} opts.pageSize Number of intended items in the response page. If not provided, it is decided by the application settings.
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/webhooks/UserWebhooks}
       */
      this.getWebhooks = function(authorization, opts) {
        return this.getWebhooksWithHttpInfo(authorization, opts)
          .then(function(response_and_data) {
            return response_and_data.data;
          });
      }
  
  
      /**
       * Updates a webhook.
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_write&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {String} ifMatch The server will only update the resource if it matches the listed ETag otherwise error RESOURCE_MODIFIED(412) is returned.
       * @param {String} webhookId The webhook identifier, as returned by the webhook creation API or retrieved from the API to fetch webhooks.
       * @param {module:model/webhooks/WebhookInfo} webhookInfo Information necessary to update a webhook
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
       */
      this.updateWebhookWithHttpInfo = function(authorization, ifMatch, webhookId, webhookInfo, opts) {
        opts = opts || {};
        var postBody = webhookInfo;
  
        // verify the required parameter 'authorization' is set
        if (authorization === undefined || authorization === null) {
          throw new Error("Missing the required parameter 'authorization' when calling updateWebhook");
        }
  
        // verify the required parameter 'ifMatch' is set
        if (ifMatch === undefined || ifMatch === null) {
          throw new Error("Missing the required parameter 'ifMatch' when calling updateWebhook");
        }
  
        // verify the required parameter 'webhookId' is set
        if (webhookId === undefined || webhookId === null) {
          throw new Error("Missing the required parameter 'webhookId' when calling updateWebhook");
        }
  
        // verify the required parameter 'webhookInfo' is set
        if (webhookInfo === undefined || webhookInfo === null) {
          throw new Error("Missing the required parameter 'webhookInfo' when calling updateWebhook");
        }
  
  
        var pathParams = {
          'webhookId': webhookId
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'Authorization': authorization,
          'x-api-user': opts['xApiUser'],
          'x-on-behalf-of-user': opts['xOnBehalfOfUser'],
          'If-Match': ifMatch
        };
        var formParams = {
        };
  
        var authNames = [];
        var contentTypes = [];
        var accepts = ['application/json'];
        var returnType = null;
  
        return this.apiClient.callApi(
          '/webhooks/{webhookId}', 'PUT',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType
        );
      }
  
      /**
       * Updates a webhook.
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_write&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {String} ifMatch The server will only update the resource if it matches the listed ETag otherwise error RESOURCE_MODIFIED(412) is returned.
       * @param {String} webhookId The webhook identifier, as returned by the webhook creation API or retrieved from the API to fetch webhooks.
       * @param {module:model/webhooks/WebhookInfo} webhookInfo Information necessary to update a webhook
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}
       */
      this.updateWebhook = function(authorization, ifMatch, webhookId, webhookInfo, opts) {
        return this.updateWebhookWithHttpInfo(authorization, ifMatch, webhookId, webhookInfo, opts)
          .then(function(response_and_data) {
            return response_and_data.data;
          });
      }
  
  
      /**
       * Updates the state of a webhook identified by webhookId in the path.
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_write&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {String} ifMatch The server will only update the resource if it matches the listed ETag otherwise error RESOURCE_MODIFIED(412) is returned.
       * @param {String} webhookId The webhook identifier, as returned by the webhook creation API or retrieved from the API to fetch webhooks.
       * @param {module:model/webhooks/WebhookStateInfo} webhookStateInfo 
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
       */
      this.updateWebhookStateWithHttpInfo = function(authorization, ifMatch, webhookId, webhookStateInfo, opts) {
        opts = opts || {};
        var postBody = webhookStateInfo;
  
        // verify the required parameter 'authorization' is set
        if (authorization === undefined || authorization === null) {
          throw new Error("Missing the required parameter 'authorization' when calling updateWebhookState");
        }
  
        // verify the required parameter 'ifMatch' is set
        if (ifMatch === undefined || ifMatch === null) {
          throw new Error("Missing the required parameter 'ifMatch' when calling updateWebhookState");
        }
  
        // verify the required parameter 'webhookId' is set
        if (webhookId === undefined || webhookId === null) {
          throw new Error("Missing the required parameter 'webhookId' when calling updateWebhookState");
        }
  
        // verify the required parameter 'webhookStateInfo' is set
        if (webhookStateInfo === undefined || webhookStateInfo === null) {
          throw new Error("Missing the required parameter 'webhookStateInfo' when calling updateWebhookState");
        }
  
  
        var pathParams = {
          'webhookId': webhookId
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'Authorization': authorization,
          'x-api-user': opts['xApiUser'],
          'x-on-behalf-of-user': opts['xOnBehalfOfUser'],
          'If-Match': ifMatch
        };
        var formParams = {
        };
  
        var authNames = [];
        var contentTypes = [];
        var accepts = ['application/json'];
        var returnType = null;
  
        return this.apiClient.callApi(
          '/webhooks/{webhookId}/state', 'PUT',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType
        );
      }
  
      /**
       * Updates the state of a webhook identified by webhookId in the path.
       * @param {String} authorization An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token&lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;webhook_write&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;webhook_write&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;in the format &lt;b&gt;&#39;Bearer {accessToken}&#39;.
       * @param {String} ifMatch The server will only update the resource if it matches the listed ETag otherwise error RESOURCE_MODIFIED(412) is returned.
       * @param {String} webhookId The webhook identifier, as returned by the webhook creation API or retrieved from the API to fetch webhooks.
       * @param {module:model/webhooks/WebhookStateInfo} webhookStateInfo 
       * @param {Object} opts Optional parameters
       * @param {String} opts.xApiUser The userId or email of API caller using the account or group token in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; If it is not specified, then the caller is inferred from the token.
       * @param {String} opts.xOnBehalfOfUser The userId or email in the format &lt;b&gt;userid:{userId} OR email:{email}.&lt;/b&gt; of the user that has shared his/her account
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}
       */
      this.updateWebhookState = function(authorization, ifMatch, webhookId, webhookStateInfo, opts) {
        return this.updateWebhookStateWithHttpInfo(authorization, ifMatch, webhookId, webhookStateInfo, opts)
          .then(function(response_and_data) {
            return response_and_data.data;
          });
      }
    };
  
    return exports;
  }));
  