GithubHelp home page GithubHelp logo

antcloud-openapi-sdk-core's Introduction

欢迎使用金融云NodeJS SDK,基于官方 @alipay/[email protected] 版本发布。

安装

$ npm install antcloud-openapi-sdk

SDK使用

  1. 创建Client实例并配置对应参数。
  2. 创建request对象,填充请求参数。
  3. 调用Client类的execute方法,获取响应结果。
const AntCloudClient = require('antcloud-openapi-sdk');

// 创建Client实例
const client = new AntCloudClient({
    endpoint: '<endpoint>',
    accessKey: '<your-access-key>',
    accessSecret: '<your-access-secret>'
    // 如果使用STS,那么可以额外传入securityToken
    // securityToken: 'xxxxxx'
});

// 创建request对象,并填充请求参数
// method和version是必须设置的参数
// 如果访问的是非核心网关(即产品网关),还需设置product_instance_id
const request = {
    method: 'antcloud.demo.gateway.check.echo',
    version: '1.0',
    input_string: 'hello world'
};

// HTTP调用相关的配置,参考https://www.npmjs.com/package/urllib#api-doc
const opt = {
    timeout: 10000, // 配置超时时间,单位为ms,默认为5s
};

// 发送调用请求,解析响应结果
client.execute(request, opt).then((resp) => {
    console.log(resp);
});

utils 方法

const { utils } = require('antcloud-openapi-sdk');

// Exp: 构造响应成功的response字符串(更多 util 方法见 lib/utils.js)
utils.buildSuccessResponseStr({ req_msg_id: '0645762ea89c49438f38a2c991dfdf13' });

antcloud-openapi-sdk-core's People

Contributors

xuxucode avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.