1.0.5 • Published 6 years ago

node-client-sdk v1.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

node-client-sdk

一、版本要求

Node > 8.9.1

二、使用方法

const Client = require("node-client-sdk");

const client = new Client({
    isEncrypt: true,            // 是否开启加密, 不加密时可忽律accessKeyID, accessKeySecret
    accessKeyID: "a04d0daa30fbad5191d794f527084441",
    accessKeySecret: "6788991a041734cb794e934f470650f1",
    domain: "http://localhost",
});

const result = await client.get('/openAPI/test/get', {a:1});

// Content-Type: 'application/x-www-form-urlencoded'
const resp = await client.post('/openAPI/test/post', {a: 11});

// Content-Type: 'application/json'
const result = await client.postJson('/openAPI/test/postJson', {a: 11});

// Content-Type: 'application/json'
const result = await client.put('/openAPI/test/put', {a: 11});

// Content-Type: 'application/json'
const result = await client.delete('/openAPI/test/delete', {a: 11});

// Content-Type: 'multipart/form-data'
const result = await client.upload('/openAPI/test/upload', {a: 11, file: path.resolve('./package.json')});

/ Content-Type: 'multipart/octet-stream'
const result = await client.uploadBinary('/openAPI/test/uploadBinary', path.resolve('./package.json'));

if (Client.isError(result)) throw result

console.log(result);
1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago