function MailjetResource (method, func, options, context) {
  this.base = func
  this.callUrl = func
  this.options = options || context.options

  this.resource = func.toLowerCase()

  this.lastAdded = RESOURCE
  var self = context

  /*
  It can be REST or nothing if we only know the resource
  */
  this.subPath = (function () {
    if (func.toLowerCase() !== 'send' && func.indexOf('sms') === -1) {
      return 'REST'
    }
    return ''
  })()

  /**
   *
   * result.
   *
   * @params (optional) {Object Littteral} parameters to be sent to the server
   * @callback (optional) {Function} called on response or error
   */
  var that = this
  this.result = function (params, callback) {
    params = params || {}
    if (typeof params === 'function') {
      callback = params
      params = {}
    }

    /*
    We build the querystring depending on the parameters. if the user explicitly mentionned
    a filters property, we pass it to the url
    */
    var path = self.path(that.callUrl, that.subPath, (function () {
      if (params.filters) {
        var ret = params.filters
        delete params.filters
        return ret
      } else if (method === 'get') {
        return params
      } else {
        return {}
      }
    })(), that.options)

    var perform_api_call = null
    if (that.options && 'perform_api_call' in that.options) {
      perform_api_call = that.options.perform_api_call
    } else {
      perform_api_call = self.config.perform_api_call
    }

    that.callUrl = that.base
    self.lastAdded = RESOURCE
    return self.httpRequest(method, 'https://' + path, params, callback, perform_api_call)
  }
}
/*
 *
 * MailjetResource constructor
 *
 * This class creates a function that can be build through method chaining
 *
 * @method {String} http method
 * @func {String} resource/path to be sent
 * @context {MailjetClient[instance]} parent client
 */
MailjetResource constructor
This class creates a function that can be build through method chaining

@method {String} http method
@func {String} resource/path to be sent
@context {MailjetClient[instance]} parent client
MailjetResource constructor This class creates a function that can be build through method chaining @method { String } http method @func { String } resource / path to be sent @context { MailjetClient [ instance ] } parent client
function MailjetResource (method, func, options, context) {
  this.base = func
  this.callUrl = func
  this.options = options || context.options
  this.resource = func.toLowerCase()
  this.lastAdded = RESOURCE
  var self = context
  this.subPath = (function () {
    if (func.toLowerCase() !== 'send' && func.indexOf('sms') === -1) {
      return 'REST'
    }
    return ''
  })()
  var that = this
  this.result = function (params, callback) {
    params = params || {}
    if (typeof params === 'function') {
      callback = params
      params = {}
    }
    var path = self.path(that.callUrl, that.subPath, (function () {
      if (params.filters) {
        var ret = params.filters
        delete params.filters
        return ret
      } else if (method === 'get') {
        return params
      } else {
        return {}
      }
    })(), that.options)
    var perform_api_call = null
    if (that.options && 'perform_api_call' in that.options) {
      perform_api_call = that.options.perform_api_call
    } else {
      perform_api_call = self.config.perform_api_call
    }
    that.callUrl = that.base
    self.lastAdded = RESOURCE
    return self.httpRequest(method, 'https://' + path, params, callback, perform_api_call)
  }
}
function MailjetResource ( method , func , options , context ) { this . base = func this . callUrl = func this . options = options || context . options this . resource = func . toLowerCase ( ) this . lastAdded = RESOURCE var self = context this . subPath = ( function ( ) { if ( func . toLowerCase ( ) !== 'send' && func . indexOf ( 'sms' ) === - 1 ) { return 'REST' } return '' } ) ( ) var that = this this . result = function ( params , callback ) { params = params || { } if ( typeof params === 'function' ) { callback = params params = { } } var path = self . path ( that . callUrl , that . subPath , ( function ( ) { if ( params . filters ) { var ret = params . filters delete params . filters return ret } else if ( method === 'get' ) { return params } else { return { } } } ) ( ) , that . options ) var perform_api_call = null if ( that . options && 'perform_api_call' in that . options ) { perform_api_call = that . options . perform_api_call } else { perform_api_call = self . config . perform_api_call } that . callUrl = that . base self . lastAdded = RESOURCE return self . httpRequest ( method , 'https://' + path , params , callback , perform_api_call ) } }
MailjetResource constructor
 This class creates a function that can be build through method chaining
MailjetResource constructor This class creates a function that can be build through method chaining
/*
  It can be REST or nothing if we only know the resource
  */ /**
   *
   * result.
   *
   * @params (optional) {Object Littteral} parameters to be sent to the server
   * @callback (optional) {Function} called on response or error
   */ /*
    We build the querystring depending on the parameters. if the user explicitly mentionned
    a filters property, we pass it to the url
    */