1.0.1 • Published 1 year ago
kuaishou-merchant-open-api v1.0.1
快手电商开放平台openAPI
Doc
Install
npm i kuaishou-merchant-open-api -S
Usage
import KsMerchantClient, { SignMethod } from 'kuaishou-merchant-open-api';
(async () => {
const client = new KsMerchantClient({
appKey: 'appKey',
signSecret: 'signSecret',
appSecret: 'appSecret'
signMethod: SignMethod.MD5,
});
// getAccessToken
await client.getAccessTokenByCode({ code: 'authCode' });
console.log(client.accessToken);
console.log(client.refreshToken);
console.log(client.openId);
// refreshAccessToken
await client.getAccessTokenByRefreshToken();
console.log(client.accessToken);
// request
client.execute({ api: 'open.item.get' }, { kwaiItemId: 123456 })
.then((res) => {
console.log(res);
});
// upload
client.execute({ api: 'open.item.image.upload' }, {
imgUrl: 'imgUrl',
imgBytes: fs.createReadStream(path.join(__dirname, './img.jpeg')),
uploadType: 1,
}).then((res) => {
console.log(res);
});
})()
API
constructor
Property Description Type Required Default appKey appId string
true
- appSecret app secret string
true
- signSecret sign secret string
true
- accessToken 授权说明 string
false
- url domain string
false
https://openapi.kwaixiaodian.com signMethod crypto SignMethod
false
SignMethod.MD5
execute
system params
Property | Description | Type | Required | Default |
---|---|---|---|---|
api | api path | string | true | - |
method | request mode | string | false | GET / POST |
version | api version | number | false | 1 |
accessToken | accessToken | string | false | - |
License
Licensed under the MIT License.
1.0.1
1 year ago
1.0.0
1 year ago
0.0.3
3 years ago
0.0.2-alpha
3 years ago
0.0.2
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.1-alpha
3 years ago
0.0.2-beta
3 years ago
0.0.1-beta2
3 years ago
0.0.1-beta
3 years ago