0.0.2 • Published 7 years ago

crm-request v0.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago
                                                                                 __ 
  _____   _____   ____ ___           _____  ___   ____ _  __  __  ___    _____  / /_
 / ___/  / ___/  / __ `__ \ ______  / ___/ / _ \ / __ `/ / / / / / _ \  / ___/ / __/
/ /__   / /     / / / / / //_____/ / /    /  __// /_/ / / /_/ / /  __/ (__  ) / /_  
\___/  /_/     /_/ /_/ /_/        /_/     \___/ \__, /  \__,_/  \___/ /____/  \__/  
                                                  /_/                               

Standard - JavaScript Style Guide Build Status

Installation

yarn add crm-request

Options

Initialize Tim plugin with the given options.

crm_request(access_token, { host: "", protocol: "" })

Options:

  • access_token 用户通过Teambition Account授权获取到的token, 用于验证请求是否合法并经过用户授权
  • host 非必需参数, 指定API地址s

Usage

  • callback
let accessToken = 'crm accessToken'
let crm = new crm_request(accessToken)

crm.get('/users/me', (err, data) => {
  // user's profile
  if (err) throw err
  console.log(data)
})
  • promise
let accessToken = 'crm accessToken'
let crm = new crm_request(accessToken)
crm
  .get('/users/me')
  .then(userprofile => console.log(userprofile))
  .catch(err => console.error(err))

License

ISC License

Copyright (c) 2017

0.0.2

7 years ago

0.0.1

7 years ago