text: /**
   * Rainbow admin portal
   * # Rainbow administrator portal API guide  ## Preamble  ### Introduction  This guide describes list of API services that are provided by OT Rainbow management portal system. Services are used to manage OT Rainbow system entities  ### Protocol  REST interface is used for sending/receiving OT rainbow API messages. HTTP requests GET, DELETE, POST, UPDATE are used. Standard HTTP responses are used to provide requested information or error status. There is no session notion in OT Rainbow system, so requests could be issued according stateless model, without transport conservation between them. Additional data could be provided in message body. JSON is used as a main format for data encoding in message body part. Each request is started with the following pattern /{module}/{version}/ where {module} is a portal module name to address and {version} is a version of used API, par example, “v1.0”.  ### Security considerations  Each request should contain some credential information to authenticate itself. Standard HTTP authentication with basic/bearer modes is used. JSON Web Token mechanism is used to provide authentication information. JWT has a expire timeout that is controlled by OT Rainbow portal to prevent very long token usage. Also authentication with application token is used. The token must be provided in the request HTTP header, using a custom header: APIKey. At server side, token is verified, and if it doesn’t match, 403 Not Allowed response is sent. TLS is used as a transport protocol to support message exchanges between OT Rainbow portal and an application.  
   *
   * The version of the OpenAPI document: 1.82.0
   *
   * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
   * https://openapi-generator.tech
   *
   * OpenAPI Generator version: 4.1.2
   *
   * Do not edit the class manually.
   *
   */
  
  (function(root, factory) {
    if (typeof define === 'function' && define.amd) {
      // AMD. Register as an anonymous module.
      define(['ApiClient', 'model/GetPbxIdSuccess', 'model/GetPbxsSuccess'], factory);
    } else if (typeof module === 'object' && module.exports) {
      // CommonJS-like environments that support module.exports, like Node.
      module.exports = factory(require('../ApiClient'), require('../model/GetPbxIdSuccess'), require('../model/GetPbxsSuccess'));
    } else {
      // Browser globals (root is window)
      if (!root.RainbowAdminPortal) {
        root.RainbowAdminPortal = {};
      }
      root.RainbowAdminPortal.PcgPbxsApi = factory(root.RainbowAdminPortal.ApiClient, root.RainbowAdminPortal.GetPbxIdSuccess, root.RainbowAdminPortal.GetPbxsSuccess);
    }
  }(this, function(ApiClient, GetPbxIdSuccess, GetPbxsSuccess) {
    'use strict';
  
    /**
     * PcgPbxs service.
     * @module api/PcgPbxsApi
     * @version 1.82.0
     */
  
    /**
     * Constructs a new PcgPbxsApi. 
     * @alias module:api/PcgPbxsApi
     * @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;
  
  
  
      /**
       * Get a pbx data
       * This API allows to retrieve a specific pbx (system) using pbxId field.    It is dedicated to PCG component.       _Note:_ id field returned in response corresponds to portal's internal mongoDB id, while pbxId is the id handled by PCG.       When the pbx (system) is updated from admin API, PCG is notified on its corresponding JID pbxpcg with the following XMPP message:        ```html <message id=\"8413b42e-563c-4437-9a53-06f638b5ab69_0\"           from=\"pcloud@openrainbow.com/172440802160413612281463752830017532\"           to=\"pbxpcg_7ca2d0aefb024c949303b508fcecdad2@openrainbow.com\"           xmlns=\"jabber:client\">      <config xmlns=\"urn:xmpp:pbxagent:config:1\">          <pbx action=\"update\"/>      </config> </message> ```       When the pbx (system) is deleted from admin API, PCG is notified with the following XMPP IQ.    PCG **must acknowledge this IQ** so that admin delete effectively the system: once IQ is acknowledged by PCG, the system is deleted from mongoDB, jid_pbxagent and jid_pbxpcg XMPP accounts are deleted from XMPP, and all phoneNumbers objects linked to this system are deleted (therefore PCG don't have to call delete for all deleted system's phoneNumbers).        ```html <iq id=\"8413b42e-563c-4437-9a53-06f638b5ab69_0\"           from=\"pcloud@openrainbow.com/172440802160413612281463752830017532\"           to=\"pbxpcg_7ca2d0aefb024c949303b508fcecdad2@openrainbow.com/pbxpcg\"           xmlns=\"jabber:client\">      <config xmlns=\"urn:xmpp:pbxagent:config:1\">          <pbx action=\"delete\">      </config> </iq> ```    
       * @param {String} pbxId Pbx unique identifier known by PCG
       * @param {String} accept application/json
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetPbxIdSuccess} and HTTP response
       */
      this.getPbxIdWithHttpInfo = function(pbxId, accept) {
        var postBody = null;
        // verify the required parameter 'pbxId' is set
        if (pbxId === undefined || pbxId === null) {
          throw new Error("Missing the required parameter 'pbxId' when calling getPbxId");
        }
        // verify the required parameter 'accept' is set
        if (accept === undefined || accept === null) {
          throw new Error("Missing the required parameter 'accept' when calling getPbxId");
        }
  
        var pathParams = {
          'pbxId': pbxId
        };
        var queryParams = {
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'accept': accept
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = [];
        var accepts = ['application/json'];
        var returnType = GetPbxIdSuccess;
        return this.apiClient.callApi(
          '/api/rainbow/pcg/v1.0/pbxs/{pbxId}', 'GET',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, null
        );
      }
  
      /**
       * Get a pbx data
       * This API allows to retrieve a specific pbx (system) using pbxId field.    It is dedicated to PCG component.       _Note:_ id field returned in response corresponds to portal's internal mongoDB id, while pbxId is the id handled by PCG.       When the pbx (system) is updated from admin API, PCG is notified on its corresponding JID pbxpcg with the following XMPP message:        ```html <message id=\"8413b42e-563c-4437-9a53-06f638b5ab69_0\"           from=\"pcloud@openrainbow.com/172440802160413612281463752830017532\"           to=\"pbxpcg_7ca2d0aefb024c949303b508fcecdad2@openrainbow.com\"           xmlns=\"jabber:client\">      <config xmlns=\"urn:xmpp:pbxagent:config:1\">          <pbx action=\"update\"/>      </config> </message> ```       When the pbx (system) is deleted from admin API, PCG is notified with the following XMPP IQ.    PCG **must acknowledge this IQ** so that admin delete effectively the system: once IQ is acknowledged by PCG, the system is deleted from mongoDB, jid_pbxagent and jid_pbxpcg XMPP accounts are deleted from XMPP, and all phoneNumbers objects linked to this system are deleted (therefore PCG don't have to call delete for all deleted system's phoneNumbers).        ```html <iq id=\"8413b42e-563c-4437-9a53-06f638b5ab69_0\"           from=\"pcloud@openrainbow.com/172440802160413612281463752830017532\"           to=\"pbxpcg_7ca2d0aefb024c949303b508fcecdad2@openrainbow.com/pbxpcg\"           xmlns=\"jabber:client\">      <config xmlns=\"urn:xmpp:pbxagent:config:1\">          <pbx action=\"delete\">      </config> </iq> ```    
       * @param {String} pbxId Pbx unique identifier known by PCG
       * @param {String} accept application/json
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetPbxIdSuccess}
       */
      this.getPbxId = function(pbxId, accept) {
        return this.getPbxIdWithHttpInfo(pbxId, accept)
          .then(function(response_and_data) {
            return response_and_data.data;
          });
      }
  
  
      /**
       * Get all pbxs
       * This API allows to list all pbxs (systems).    It is dedicated to PCG component.       _Note:_ id field returned in response corresponds to portal's internal mongoDB id, while pbxId is the id handled by PCG.
       * @param {String} accept application/json
       * @param {Object} opts Optional parameters
       * @param {String} opts.format Allows to retrieve more or less pbxs details in response.    - `small`: id pbxId version creationDate    - `medium`: id name pbxId serialNumber version status creationDate    - `full`: all pbxs fields
       * @param {String} opts.sortField Sort pbxs list based on the given field.
       * @param {Number} opts.limit Allow to specify the number of systems to retrieve.
       * @param {Number} opts.offset Allow to specify the position of first system to retrieve (first site if not specified). Warning: if offset > total, no results are returned.
       * @param {Number} opts.sortOrder Specify order when sorting pbx list.
       * @param {String} opts.name Allows to filter systems list on field name.       The filtering is case insensitive and on partial name match: all systems **containing** the provided name value will be returned (whatever the position of the match).    Ex: if filtering is done on _oxe1_, systems with the following names are match the filter 'OXE1', 'Oxe1', 'My oxe1', 'oxe12', 'My OXE12', ...
       * @param {String} opts.type Allows to filter systems list on the provided type(s)
       * @param {String} opts.status Allows to filter systems list on the provided status(es)
       * @param {String} opts.siteId Allows to filter systems list on the siteIds provided in this option.
       * @param {String} opts.companyId Allows to filter systems list on the siteIds linked to companyIds provided in this option.
       * @param {String} opts.bpId Allows to filter systems list on the bpIds provided in this option.    Only `superadmin`, `support` and `bp_admin` users can use bpId filter.    `bp_admin` users can only use bpId filter with bpId they manage (their own BP company or companies being in their BP organisation).
       * @param {Boolean} opts.isShared Allows to filter systems list by the status isShared.
       * @param {Boolean} opts.isCentrex Allows to filter systems list by the status isCentrex.
       * @param {Boolean} opts.isSharedOrCentrex Allows to filter systems list having the requested flag isShared **or** isCentrex.   * If isSharedOrCentrex=true, only systems having isShared=true or isCentrex=true are returned. * If isSharedOrCentrex=false, only systems having isShared=false and isCentrex=false are returned.  
       * @param {Date} opts.fromCreationDate Allows to filter systems list from provided date (ISO 8601 format).
       * @param {Date} opts.toCreationDate Allows to filter systems list until provided date (ISO 8601 format).
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetPbxsSuccess} and HTTP response
       */
      this.getPbxsWithHttpInfo = function(accept, opts) {
        opts = opts || {};
        var postBody = null;
        // verify the required parameter 'accept' is set
        if (accept === undefined || accept === null) {
          throw new Error("Missing the required parameter 'accept' when calling getPbxs");
        }
  
        var pathParams = {
        };
        var queryParams = {
          'format': opts['format'],
          'sortField': opts['sortField'],
          'limit': opts['limit'],
          'offset': opts['offset'],
          'sortOrder': opts['sortOrder'],
          'name': opts['name'],
          'type': opts['type'],
          'status': opts['status'],
          'siteId': opts['siteId'],
          'companyId': opts['companyId'],
          'bpId': opts['bpId'],
          'isShared': opts['isShared'],
          'isCentrex': opts['isCentrex'],
          'isSharedOrCentrex': opts['isSharedOrCentrex'],
          'fromCreationDate': opts['fromCreationDate'],
          'toCreationDate': opts['toCreationDate'],
        };
        var collectionQueryParams = {
        };
        var headerParams = {
          'accept': accept
        };
        var formParams = {
        };
  
        var authNames = ['Bearer'];
        var contentTypes = [];
        var accepts = ['application/json'];
        var returnType = GetPbxsSuccess;
        return this.apiClient.callApi(
          '/api/rainbow/pcg/v1.0/pbxs', 'GET',
          pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, null
        );
      }
  
      /**
       * Get all pbxs
       * This API allows to list all pbxs (systems).    It is dedicated to PCG component.       _Note:_ id field returned in response corresponds to portal's internal mongoDB id, while pbxId is the id handled by PCG.
       * @param {String} accept application/json
       * @param {Object} opts Optional parameters
       * @param {String} opts.format Allows to retrieve more or less pbxs details in response.    - `small`: id pbxId version creationDate    - `medium`: id name pbxId serialNumber version status creationDate    - `full`: all pbxs fields
       * @param {String} opts.sortField Sort pbxs list based on the given field.
       * @param {Number} opts.limit Allow to specify the number of systems to retrieve.
       * @param {Number} opts.offset Allow to specify the position of first system to retrieve (first site if not specified). Warning: if offset > total, no results are returned.
       * @param {Number} opts.sortOrder Specify order when sorting pbx list.
       * @param {String} opts.name Allows to filter systems list on field name.       The filtering is case insensitive and on partial name match: all systems **containing** the provided name value will be returned (whatever the position of the match).    Ex: if filtering is done on _oxe1_, systems with the following names are match the filter 'OXE1', 'Oxe1', 'My oxe1', 'oxe12', 'My OXE12', ...
       * @param {String} opts.type Allows to filter systems list on the provided type(s)
       * @param {String} opts.status Allows to filter systems list on the provided status(es)
       * @param {String} opts.siteId Allows to filter systems list on the siteIds provided in this option.
       * @param {String} opts.companyId Allows to filter systems list on the siteIds linked to companyIds provided in this option.
       * @param {String} opts.bpId Allows to filter systems list on the bpIds provided in this option.    Only `superadmin`, `support` and `bp_admin` users can use bpId filter.    `bp_admin` users can only use bpId filter with bpId they manage (their own BP company or companies being in their BP organisation).
       * @param {Boolean} opts.isShared Allows to filter systems list by the status isShared.
       * @param {Boolean} opts.isCentrex Allows to filter systems list by the status isCentrex.
       * @param {Boolean} opts.isSharedOrCentrex Allows to filter systems list having the requested flag isShared **or** isCentrex.   * If isSharedOrCentrex=true, only systems having isShared=true or isCentrex=true are returned. * If isSharedOrCentrex=false, only systems having isShared=false and isCentrex=false are returned.  
       * @param {Date} opts.fromCreationDate Allows to filter systems list from provided date (ISO 8601 format).
       * @param {Date} opts.toCreationDate Allows to filter systems list until provided date (ISO 8601 format).
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetPbxsSuccess}
       */
      this.getPbxs = function(accept, opts) {
        return this.getPbxsWithHttpInfo(accept, opts)
          .then(function(response_and_data) {
            return response_and_data.data;
          });
      }
    };
  
    return exports;
  }));
  