1.2.12 • Published 7 years ago

sugo-agent-base v1.2.12

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

sugo-agent-base

Build Status npm Version JS Standard

Base class of HTTP clients for SUGOS

Installation

$ npm install sugo-agent-base --save

Usage

'use strict'

const { SugoAgentBase } = require('sugo-agent-base')
const co = require('co')

class YourCustomAgent extends SugoAgentBase() {
  constructor (url, options = {}) {
    super(url, options)
    /* ... */
  }

  doSomething (/* ... */) {
    const s = this
    let { request, url } = s
    return co(function * () {
      let { statusCode, body } = request.post(`${url}/hoge`, {
        data: {}
      })
      /* ... */
    })
  }
}

let agent = new YourCustomAgent()
/* ... */

License

This software is released under the MIT License.

Links