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 🙏

© 2025 – Pkg Stats / Ryan Hefner

zonelink-ele-sdk

v1.0.1

Published

sdk for ele openapi

Downloads

1

Readme

饿了么商家开放平台 SDK 接入指南 & CHANGELOG

安装

  npm install eleme-openapi-sdk --save

代码示例

企业应用

  • 第一步 引入sdk
  var eleme = require('eleme-openapi-sdk');
  • 第二步 实例化一个配置对象
  var config = new eleme.Config({
    key: 'yourkey',
    secret: 'yoursecret',
    sandbox: false // 是否沙箱环境
  });
  • 第三步 实例化一个oauth2.0客户端授权模式的授权对象
  var oAuthClient = eleme.OAuthClient(config);
  • 第四步 获取生成授权url
  var authUrl = oAuthClient.getOAuthUrl(callbackUrl,state, scope)
  • 第五步 在授权url中同意授权后,会跳转到CALLBACK_URL的页面,在通过链接上的参数,获取授权码code

  • 第六步 通过code获取Token对象(返回值为一个promise),此步获取到的token对象可在有效期内一直使用,不用每次调用前都去获取一次,建议应用授权一次后存放到全局缓存中

  oAuthClient
    .getTokenByCode(code, callbackUrl)
    .then(result => {
      var token = result.access_token
      // 实例化rpcClient对象
      var rpcClient = new eleme.RpcClient(token, config);
      // 实例化一个服务对象
      var userService = new eleme.UserService(rpcClient);
      userService
        .getUser()
        .then(result => {
          var userId = result.userId;
          // 建立userId与token,自行实现
          saveToken(userId, token)
        })
    })

个人应用

  • 第一步 引入sdk
  var eleme = require('eleme-openapi-sdk');
  • 第二步 实例化一个配置对象
  var config = new eleme.Config({
    key: 'yourkey',
    secret: 'yoursecret',
    sandbox: false // 是否沙箱环境
  });
  • 第三步 实例化一个oauth2.0客户端授权模式的授权对象
  var oAuthClient = eleme.OAuthClient(config);
  • 第四步 获取token
  oAuthClient.getToken()
    .then(result => {
      var token = result.access_token
    })
  • 第五步 实例化远程调用的rpcClient对象
  var rpcClient = new eleme.RpcClient(token, config);
  • 第六步 实例化一个服务对象
  var shopService = new eleme.ShopService(rpcClient)
  • 第七步 调用服务方法,获取资源数据,返回promise对象
  shopService.getShop(123456).then(shopInfo => {})

根据refresh_token更新token

  • 第一步 实例化一个oauth2.0客户端授权模式的授权对象(方法同上)
  • 第二步 获取token,注:refreshToken在getTokenByCode方法中返回
  oAuthClient
    .getTokenByRefreshToken(refreshToken)
    .then(result => {
      var token = result.access_token
    })

调用不需要授权的接口

  // 用空字符串替代 token
  var rpcClient = new eleme.RpcClient('', config);

相关文档

https://open.shop.ele.me/openapi/documents/workflow

api接口示例demo

https://open.shop.ele.me/openapi/apilist/eleme-product/eleme-product-category-getShopCategories

具体业务demo

https://coding.net/u/napos_openapi/p/eleme-openapi-nodejs-sdk/git/tree/master/demo

CHANGELOG:

[1.21.2]

Release Date : 2021-09-18

  • [Feature] 新增接口

[1.21.1]

Release Date : 2021-07-08

  • [Feature] 新增接口

[1.21.0]

Release Date : 2021-04-30

  • [Feature] 新增商家服务中台服务

[1.20.23]

Release Date : 2021-01-12

  • [Feature] 新增企业订餐服务;订单服务、活动服务、金融服务、商品服务、内容服务更新接口

[1.20.22]

Release Date : 2020-04-24

  • [Feature] 新增招聘市场服务、企业订单服务;订单服务更新接口

[1.20.21]

Release Date : 2020-03-30

  • [Feature] 商品服务更新、新增接口

[1.20.20]

Release Date : 2019-12-27

  • [Feature] 金融服务新增接口

[1.20.19]

Release Date : 2019-12-23

  • [Feature] 店铺服务新增接口

[1.20.18]

Release Date : 2019-11-18

  • [Feature] 新增商户信用分服务,订单服务更新接口

[1.20.17]

Release Date : 2019-9-26

  • [Feature] 活动服务下线接口

[1.20.16]

Release Date : 2019-8-30

  • [Feature] 新增经营体检服务

[1.20.15]

Release Date : 2019-7-19

  • [Feature] 服务市场服务新增接口

[1.20.14]

Release Date : 2019-7-09

  • [Feature] 消息服务新增接口

[1.20.13]

Release Date : 2019-6-28

  • [Feature] 内容服务下线接口

[1.20.12]

Release Date : 2019-5-24

  • [Feature] 店铺服务新增接口

[1.20.11]

Release Date : 2019-5-10

  • [Feature] 活动服务下线接口

[1.20.10]

Release Date : 2019-4-15

  • [Feature] 活动服务新增接口

[1.20.9]

Release Date : 2019-4-12

  • [Feature] 商户会员卡服务新增接口

[1.20.8]

Release Date : 2019-3-5

  • [Feature] 商品服务新增接口

[1.20.7]

Release Date : 2019-2-22

  • [Feature] 餐厅入口流量服务下线接口

[1.20.6]

Release Date : 2019-1-3

  • [Feature] 商品服务新增更新接口

[1.20.5]

Release Date : 2018-12-28

  • [Feature] 商品服务新增接口
  • [Feature] 服务市场服务新增接口

[1.20.4]

Release Date : 2018-12-21

  • [Feature] 订单评价服务新增更新接口
  • [Feature] 门店装修服务下线接口

[1.20.3]

Release Date : 2018-12-7

  • [Feature] 订单服务更新接口

[1.20.2]

Release Date : 2018-11-30

  • [Feature] 店铺服务新增接口
  • [Feature] requestId新增时间戳后缀

[1.20.1]

Release Date : 2018-11-15

  • [Feature] 活动服务新增接口
  • [Feature] 店铺服务新增接口
  • [Feature] 商户会员卡服务更新接口

[1.19.5]

Release Date : 2018-10-17

  • [Feature] 活动服务新增接口
  • [Feature] 订单评论服务更新接口
  • [Feature] 订单服务新增更新接口

[1.19.4]

Release Date : 2018-9-29

  • [Feature] 新增商户数据服务
  • [Feature] 店铺服务更新接口

[1.18.4]

Release Date : 2018-9-21

  • [Feature] 商户会员卡服务更新接口
  • [Feature] 店铺装修服务服务更新接口
  • [Feature] 短信服务新增接口

[1.17.4]

Release Date : 2018-9-14

  • [Feature] 订单服务新增接口

[1.17.3]

Release Date : 2018-9-7

  • [Feature] 活动服务新增接口
  • [Feature] 店铺服务新增接口
  • [Feature] 商品服务新增接口

[1.16.3]

Release Date : 2018-8-17

  • [Feature] 活动服务新增接口
  • [Feature] 商户会员卡服务修复bug

[1.16.2]

Release Date : 2018-8-3

  • [Feature] 商品服务更新接口
  • [Feature] 新增商户会员卡服务
  • [Feature] 新增CPC竞价服务

[1.15.2]

Release Date : 2018-7-27

  • [Feature] 订单服务新增接口
  • [Feature] 商品服务新增接口
  • [Feature] 店铺服务新增接口

[1.14.2]

Release Date : 2018-7-13

  • [Feature] 订单评论服务新增接口

[1.14.1]

Release Date : 2018-7-6

  • [Feature] 内容服务新增接口
  • [Feature] 商品服务新增接口
  • [Feature] 上传视频接口封装

[1.13.1]

Release Date : 2018-6-28

  • [Feature] 内容服务新增接口
  • [Feature] 商品服务新增接口
  • [Feature] 订单服务新增接口
  • [Feature] 店铺装修服务新增接口
  • [Feature] 店铺服务新增接口

[1.12.1]

Release Date : 2018-6-22

  • [Feature] 更新了店铺服务

[1.12.0]

Release Date : 2018-6-08

  • [Feature] 更新了活动服务
  • [Feature] 更新了订单服务

[1.11.0]

Release Date : 2018-5-18

  • [Feature] 新增授权码换取OpenId接口
  • [Feature] 活动服务新增若干接口
  • [Feature] 商品服务新增接口

[1.10.0]

Release Date : 2018-3-23

  • [Feature] 增加若干新服务

[1.9.1]

Release Date : 2018-2-2

  • [Feature] 活动服务增加定向赠券接口

[1.8.1]

Release Date : 2018-1-18

  • [Feature] 新增服务市场服务
  • [Feature] 订单评论服务增加了若干赠券接口

[1.7.0]

Release Date : 2018-1-5

  • [Feature] 商品服务新增根据店铺 Id 查询商品接口

[1.6.0]

Release Date : 2017-12-29

  • [Feature] 店铺服务新增设置是否支持预定单及预定天数接口
  • [Feature] 订单服务新增出餐和评价骑手接口
  • [Feature] 订单评论服务新增新版回复评论接口

[1.5.0]

Release Date : 2017-12-1

  • [Feature] 新增众包查询配送费接口

[1.4.0]

Release Date : 2017-10-27

  • [Feature] 新增了代金券和零元试吃的活动接口

[1.4.0]

Release Date : 2017-10-27

  • [Feature] 新增了代金券和零元试吃的活动接口

v1.3.0

Release Date : 2017-08-04

  • [Feature] 增加部分金融接口

v1.2.0

Release Date : 2017-07-27

  • [Feature] 增加了参数的非空校验

v1.1.0

Release Date : 2017-07-07

  • [Feature] 新增了金融服务

v1.0.0

Release Date : 2017-05-24

  • [Feature] 升级sdk版本为1.00