Socket
Book a DemoInstallSign in
Socket

@tswjs/open-platform-api

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tswjs/open-platform-api

Open api for https://tswjs.org

2.0.8
latest
Source
npmnpm
Version published
Maintainers
3
Created
Source

open-platform-api

Open api for https://tswjs.org

Install

yarn add @tswjs/open-platform-api

Usage

const { OpenApi } = require("@tswjs/open-platform-api");

const client = new OpenApi();

/**
 * 从开放平台同步代理名单
 */
client.updateProxyEnvByCloud().then(d => {
  console.log(d);
}, e => {
  console.error(e);
});

/**
 * 获取测试环境列表
 * @param {String} group 测试环境分组,默认获取全部环境
 */
client.listTestEnv().then(d => {
  console.log(d);
}, e => {
  console.error(e);
});

/**
 * 添加白名单
 * @param {string} uin 白名单号码 e.g 12345
 * @param {string} val 环境列表,或者是 alpha 只染色 e.g 127.0.0.1:8080 或者 alpha
 */
client.addTestUid(uin, val).then(d => {
  console.log(d);
}, e => {
  console.error(e);
});

/**
 * 清除测试环境对应白名单号码
 * @param {String[]} uinList 白名单号码列表
 */
client.removeTestUid(uinList).then(d => {
  console.log(d);
}, e => {
  console.error(e);
});

‼️ 重要

2.0版本以后,不再允许将开放平台申请的 appidappkey 通过参数的形式透传到插件中。业务可以选择用合适的方式将这两个参数挂载到环境变量当中,对应形式如下且环境变量的名称不可更改: 废弃不合理特性,允许通过参数传入票据,无指定才会读取环境变量

appid => process.env.APP_ID
appkey =>  process.env.APP_KEY

FAQs

Package last updated on 11 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.