__
_____ _____ ____ ___ _____ ___ ____ _ __ __ ___ _____ / /_
/ ___/ / ___/ / __ `__ \ ______ / ___/ / _ \ / __ `/ / / / / / _ \ / ___/ / __/
/ /__ / / / / / / / //_____/ / / / __// /_/ / / /_/ / / __/ (__ ) / /_
\___/ /_/ /_/ /_/ /_/ /_/ \___/ \__, / \__,_/ \___/ /____/ \__/
/_/
yarn add crm-request
Initialize Tim plugin with the given options.
crm_request(access_token, { host: "", protocol: "" })
Options:
-
access_token
用户通过Teambition Account授权获取到的token, 用于验证请求是否合法并经过用户授权 -
host
非必需参数, 指定API地址s
- 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))
ISC License
Copyright (c) 2017