text: /**
   * PepipostLib
   *
   * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
   */
  
  'use strict';
  
  const _request = require('../Http/Client/RequestClient');
  const _configuration = require('../configuration');
  const _apiHelper = require('../APIHelper');
  const _baseController = require('./BaseController');
  
  class DomainDeleteController {
      /**
       * This endpoint allows you to delete a domain from your Pepipost account.
       *
       * @param {Deletedomain} body delete domain
       *
       * @callback    The callback function that returns response from the API call
       *
       * @returns {Promise}
       */
      static deletedomain(body, callback) {
          // create empty callback if absent
          const _callback = typeof callback === 'function' ? callback : () => undefined;
  
          // prepare query string for API call
          const _baseUri = _configuration.BASEURI;
  
          const _pathUrl = '/domain/delete';
          const _queryBuilder = `${_baseUri}${_pathUrl}`;
  
          // validate and preprocess url
          const _queryUrl = _apiHelper.cleanUrl(_queryBuilder);
  
          // prepare headers
          const _headers = {
              'content-type': 'application/json; charset=utf-8',
              api_key: _configuration.apiKey,
              'user-agent': 'APIMATIC 2.0',
          };
  
          // construct the request
          const _options = {
              queryUrl: _queryUrl,
              method: 'DELETE',
              headers: _headers,
              body: _apiHelper.jsonSerialize(body),
          };
  
          // build the response processing.
          return new Promise((_fulfill, _reject) => {
              _request(_options, (_error, _response, _context) => {
                  let errorResponse;
                  if (_error) {
                      errorResponse = _baseController.validateResponse(_context);
                      _callback(errorResponse.error, errorResponse.response, errorResponse.context);
                      _reject(errorResponse.error);
                  } else if (_response.statusCode >= 200 && _response.statusCode <= 206) {
                      const _strResult = _response.body;
                      const _result = JSON.parse(_strResult);
                      _callback(null, _result, _context);
                      _fulfill(_result);
                  } else if (_response.statusCode === 400) {
                      const _err = { errorMessage: 'API Response', errorCode: 400, errorResponse: _response.body };
                      _callback(_err, null, _context);
                      _reject(_err);
                  } else if (_response.statusCode === 401) {
                      const _err = { errorMessage: 'API Response', errorCode: 401, errorResponse: _response.body };
                      _callback(_err, null, _context);
                      _reject(_err);
                  } else if (_response.statusCode === 403) {
                      const _err = { errorMessage: 'API Response', errorCode: 403, errorResponse: _response.body };
                      _callback(_err, null, _context);
                      _reject(_err);
                  } else if (_response.statusCode === 405) {
                      const _err = { errorMessage: 'Invalid input', errorCode: 405, errorResponse: _response.body };
                      _callback(_err, null, _context);
                      _reject(_err);
                  } else {
                      errorResponse = _baseController.validateResponse(_context);
                      _callback(errorResponse.error, errorResponse.response, errorResponse.context);
                      _reject(errorResponse.error);
                  }
              });
          });
      }
  }
  module.exports = DomainDeleteController;
  