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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gaoding/ums-sdk

v1.4.16

Published

server and client sdk for ums-server with js version

Downloads

85

Readme

UMS-SDK

v1-doc

installation

npm install @gaoding/ums-sdk --save

init

const Ums = require('@gaoding/ums-sdk');
const ums = new Ums(options);
  • Options parameters
    • name 应用名称
    • version 应用版本
    • appid 应用appid
    • appsecret 应用密钥

methods

实例方法

注册

const result = await ums.register(ctx);
  • ctx.request.body
    • guest_token 游客token, 注册游客必须此参数
    • code 短信验证码
    • mobile 手机号
    • password 密码
    • nick 昵称
    • avatar 头像url
    • mobile_area_code 国家手机区号
    • source
  • result

获取阿里oss-token

const result = await ums.oss(ctx);
  • ctx.request.body
    • key 文件key
    • file_type 默认image

获取注册短信验证码

const result = await ums.registerSms(ctx);
  • ctx.request.body
    • type 验证码类型,取值有['find_password', 'register']
    • mobile 手机号

获取重新绑定手机号验证码

const result = await ums.rebindSms(ctx);
  • ctx.request.body
    • mobile 新手机号
    • password 用户密码

获取oauth-access-token

const result = await ums.oauthLogin(ctx);
  • ctx.request.body
    • grant_type oauth 请求的model类型,取值有 ['password', 'refresh_token', 'authorization_code']
    • client_id oauth 的客户端标识
    • client_secret oauth 的客户端密钥
    • [code] 授权码,grant_type=authorization_code 时需要
    • [redirect_uri] 获取authorization_code时的重定向uri,grant_type=authorization_code 时需要
    • [refresh_token] 预刷新token, grant_type=refresh_token 时需要
    • [username] grant_type=password 时需要
    • [password] grant_type=password 时需要
  • result
    • accessToken 访问凭证
    • accessTokenExpiresAt 凭证失效时间
    • refreshToken 预刷新token
    • refreshTokenExpiresAt 预刷新token失效时间
    • scope token访问空间

销毁oauth-token

const result = await ums.revoke(ctx);
  • ctx.request.body
    • token_type_hint token类型 ['accessToken', 'refreshToken']
    • token token_type_hint=accessToken时,传入客户端的accessToken值,token_type_hint=refreshToken时,传入客户端的refreshToken值
  • result
    • code 200, 请求成功时返回

获取登录用户的个人信息

const result = await ums.getUserInfo(ctx);
  • ctx.request.header
    • Authorization Bearer ${accessToken}, Bearer是固定格式
  • result

游客登录

const result = await ums.guestLogin(ctx);
  • ctx.query || ctx.request.body
    • guest_token 游客凭证
    • client_id 客户端标识
    • client_secret 客户端密钥
  • result
    • accessToken 访问凭证
    • accessTokenExpiresAt 凭证失效时间
    • refreshToken 预刷新token
    • refreshTokenExpiresAt 预刷新token失效时间
    • scope token访问空间