3cplusv2-sdk-js 中文文档教程
3Cplus SDK JS
内部使用的 SDK 用于联系 3cplusv2 的 api 和套接字,公开一致且可重用的接口。
Installation
yarn add 3cplusv2-sdk-js --save
Usage
import TcSDK from '3cplusv2-sdk-js'
// The constructor receives the same options as axios.create
const sdk = new TcSDK({
baseURL: "https://app.3c.fluxoti.com"
})
.v1()
.withAuth('your_api_token_here')
.socket('https://socket.3c.fluxoti.com')
# Http Api
sdk.user().me()
.then((response) => console.log(response.data))
.catch((err) => console.log(err.response.data))
# Realtime integration
const socket = sdk.realtime().integration()
socket.on('connect', (event) => console.log('Listening for events'))
socket.on('integration', (event) => console.log(event))
socket.on('error', (err) => console.log(err))
所有可用的 api 端点都在 .vX()
下,由部分分隔。 每个方法都返回一个 axios promise。
请参阅 Api 文档 以获取有关请求参数、响应和错误的约定的更多信息。
3Cplus SDK JS
A SDK used internally to contact the api and socket of the 3cplusv2 exposing a consistent and reusable interface.
Installation
yarn add 3cplusv2-sdk-js --save
Usage
import TcSDK from '3cplusv2-sdk-js'
// The constructor receives the same options as axios.create
const sdk = new TcSDK({
baseURL: "https://app.3c.fluxoti.com"
})
.v1()
.withAuth('your_api_token_here')
.socket('https://socket.3c.fluxoti.com')
# Http Api
sdk.user().me()
.then((response) => console.log(response.data))
.catch((err) => console.log(err.response.data))
# Realtime integration
const socket = sdk.realtime().integration()
socket.on('connect', (event) => console.log('Listening for events'))
socket.on('integration', (event) => console.log(event))
socket.on('error', (err) => console.log(err))
All available api endpoints are under .vX()
, separated by sections. Each method return an axios promise.
Please refer to the Api Documentation for more info about the conventions of the request parameters, responses and errors.
更多
你可能也喜欢
- 2acoin-multi-hashing 中文文档教程
- 98k-loading 中文文档教程
- @0x/tslint-config 中文文档教程
- @64robots/r64components 中文文档教程
- @8trhieu/ckeditor5-build-classic-custom 中文文档教程
- @abbott-platform/botkit-storage-datastore 中文文档教程
- @abcum/ember-table 中文文档教程
- @abhi1266/test__package 中文文档教程
- @acent/react 中文文档教程
- @acme-top/express-mock-middleware 中文文档教程