@blueislandx/island-union-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published


小蓝岛购物平台联盟聚合 SDK

npm version install size npm bundle size npm downloads Known Vulnerabilities

本 SDK 支持以下购物平台联盟:

P.S: 若没有特别标注, 所有签名算法均使用 MD5 实现

1.如何安装

npm i @blueislandx/island-union-sdk --save

2.如何使用

import union from '@blueislandx/island-union-sdk';

const client = new union.taobao.Client({
    appKey: '<你的 AppKey>',
    secretKey: '<你的 SecretKey>'
});

const result = await client.execute('<API 方法名称>', { <业务参数> });

P.S: 淘宝联盟接口必须传入字符 id, 数字 id 已经下线无法使用

import union from '@blueislandx/island-union-sdk';

const client = new union.jd.Client({
    appKey: '<你的 AppKey>',
    secretKey: '<你的 SecretKey>'
});

const result = await client.execute('<API 方法名称>', { <业务参数> });
import union from '@blueislandx/island-union-sdk';

const client = new union.pinduoduo.Client({
    appKey: '<你的 ClientId>',
    secretKey: '<你的 ClientSecret>'
});

const result = await client.execute('<API 方法名称>', { <业务参数> });

P.S: 多多进宝接口必须传入 goods_sign (字符 id), goods_id (数字 id) 已经下线无法使用

import union from '@blueislandx/island-union-sdk';

const client = new union.suning.Client({
    appKey: '<你的 AppKey>',
    secretKey: '<你的 AppSecret>'
});

const result = await client.execute('<API 方法名称>', { <业务参数> });
import union from '@blueislandx/island-union-sdk';

const client = new union.vip.Client({
    appKey: '<你的 AppKey>',
    secretKey: '<你的 AppSecret>'
});

const result = await client.execute('<API 服务名称>', '<API 服务版本>', '<API 方法名称>', { <业务参数> });
import union from '@blueislandx/island-union-sdk';

const client = new union.kaola.Client({
    secretKey: '<你的 AppSecret>',
    unionId: '<你的赚客 Id>'
});

const result = await client.execute('<API 接口名称>', { <业务参数> });
import union from '@blueislandx/island-union-sdk';

const client = new union.youzan.Client({
    appKey: '<你的 AppKey>',
    secretKey: '<你的 AppSecret>',
    grantId: '<你的有赞客 Id>'
});

const result = await client.execute('<API 接口名称>', '<API 接口版本>', { <业务参数> });

3.错误处理

如果 SDK 请求错误会返回如下格式:

{
    "code": <错误代码>,
    "message": "<错误信息>",
    "error": true
}

P.S: 判断一个请求是否失败, 请使用 error 字段而不是使用 code 字段

P.S: 错误代码 不一定 是整数类型, 请不要 parseInt, SDK 内部已经对字符串的数字进行了处理

4.重大变更

1.1.0 起, 导入名称由 island 改为 union

P.S: 该改动是由于公司内部业务模块化, 全部使用 island 会导致混乱

Package Sidebar

Install

npm i @blueislandx/island-union-sdk

Weekly Downloads

6

Version

1.1.2

License

MIT

Unpacked Size

344 kB

Total Files

95

Last publish

Collaborators

  • blueislandx