0.2.1 • Published 2 years ago
kingdee-sdk v0.2.1
kingdee-sdk
const kingdeeSdk = require("kingdee-sdk")
import kingdeeSdk from "kingdee-sdk";
const clientID = ''
const clientSecret = ''
const appKey = ''
const appSecret = ''
const outerInstanceId = ''
const uid = ''
const appToken = ''
const domain = 'https://tf.jdy.com' // 我在写SDK的时候填这个,后面可能会填获取到的domain
const url = 'https://api.kingdee.com/jdy/v2/bd/material'
const method = 'GET'
const params = {
'search': ''
}
const data = {}
let getAppTokenResult = await kingdeeSdk.getAppToken({ clientID, clientSecret, appKey, appSecret})
console.log(getAppTokenResult)
const pushAppAuthorizeResult = await kingdeeSdk.pushAppAuthorize({ clientID, clientSecret, outerInstanceId })
console.log(pushAppAuthorizeResult)
// 建议使用 invokeApiWithConfig
const invokeApiClient = await kingdeeSdk.invokeApiWithConfig({ clientID, clientSecret, appToken, domain })
const invokeApiClientResult = await invokeApiClient({ url, method, params, data })
console.log(invokeApiClientResult)
// 也可以直接用 invokeApi
const invokeApiResult = await kingdeeSdk.invokeApi({ clientID, clientSecret, appToken, domain, url, method, params, data })
console.log(invokeApiResult)