npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@waywake/youzanyun-sdk

v2.0.15

Published

YouzanYun SDK for Node

Readme

YouzanYun SDK

NPM Version License Downloads Build Status Coverage Status

YouzanYun SDK for Node.

Install

npm i @waywake/youzanyun-sdk --save

Usage

可参考 examples

1. 获取及刷新access_token

工具型应用 获取access_token

const youzanyun = require('@waywake/youzanyun-sdk');

// 获取token
const resp = youzanyun.token.get({
  authorize_type: 'authorization_code',
  client_id: 'YOUR_CLIENT_ID',
  client_secret: 'YOUR_CLIENT_SECRET',
  code: 'YOUR_CODE',
  redirect_uri: 'YOUR_REDIRECT_URI',
});

自用型应用 获取access_token

const youzanyun = require('@waywake/youzanyun-sdk');

const resp = youzanyun.token.get({
  authorize_type: 'silent',
  client_id: 'YOUR_CLIENT_ID',
  client_secret: 'YOUR_CLIENT_SECRET',
  grant_id: 110,
  refresh: true, // 是否获取refresh_token(可通过refresh_token刷新token)
});

工具型应用及自用型应用 刷新access_token

const youzanyun = require('@waywake/youzanyun-sdk');

// 刷新token
const resp = youzanyun.token.get({
  authorize_type: 'refresh_token',
  client_id: 'YOUR_CLIENT_ID',
  client_secret: 'YOUR_CLIENT_SECRET',
  refresh_token: 'YOUR_REFRESH_TOKEN',
});

2. 接口调用

Client 实例方式

const youzanyun = require('@waywake/youzanyun-sdk');

const client = new youzanyun.Client({
  getToken: async () => 'YOUR_TOKEN',
});

const resp = await client.tradesSoldGet({
  start_created: '2026-06-01 00:00:00',
  end_created: '2026-06-01 23:59:59',
  page_no: 1,
  page_size: 20,
});

调用免登接口时,可通过 authExempt 跳过 token 注入:

const resp = await client.call({
  api: 'youzan.shop.get',
  version: '3.0.0',
  authExempt: true,
});

Token方式

const youzanyun = require('@waywake/youzanyun-sdk');

const token = 'f59b1a6bb04f4eqweqd1c6af315d';
const params = {tid: 'E20190509110527067500013'};

const resp = youzanyun.client.call({
  api: 'youzan.trade.get',
  version: '4.0.0',
  token,
  params,
});

文件上传

const youzanyun = require('@waywake/youzanyun-sdk');

const token = 'f59b1a6bb0asdasq613d1c6af315d';
const files = {'image': path.resolve(__dirname, './pic.png')};

const resp = youzanyun.client.call({
  api: 'youzan.materials.storage.platform.img.upload',
  version: '3.0.0',
  token,
  params: {},
  files,
});

订单批量查询

const youzanyun = require('@waywake/youzanyun-sdk');

const token = 'YOUR_TOKEN';

const resp = youzanyun.client.tradesSoldGet({
  token,
  params: {
    start_created: '2026-06-01 00:00:00',
    end_created: '2026-06-01 23:59:59',
    page_no: 1,
    page_size: 20,
  },
});

新增接口封装

固定 API 封装统一通过 createTokenApiCaller 生成。新增接口时,将接口名和版本写入 src/api-definitions.ts,在 src/types.ts 增加参数类型,再用该参数类型生成对应方法。

3. 消息解密

const youzanyun = require('@waywake/youzanyun-sdk');

const messages = 'YOUR_RECEIVED_MESSAGES';
const clientSecret = 'YOUR_CLIENT_SECRET';

const resp = youzanyun.crypto.decrypt(messages, clientSecret);

License

MIT