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

@souche2014/bulter-api

v1.0.5

Published

车管家SDK

Downloads

4

Readme

bulter-api 车管家小程序API

车管家小程序为合作方提供的开放api服务,此sdk仅用于开发期间的功能接入,调用api方法也只会返回固定的假数据,只有当三方代码运行在车管家小程序中时,才会返回有效数据

使用说明:

  1. 添加依赖
yarn add @souche2014/bulter-api
  1. 使用(示例):
import bulterApi from '@souche2014/bulter-api'

//创建api实例
const api = bulterApi({ partner: '填写你在车管家的唯一标识,建议使用分包名' })
//发送埋点
api.bury('userClickPayButton',{time:new Date().valueof(),loginState:false})
//用户注册
api.register({
    encryptedData: '通过调用微信的getPhoneNumber获取到的加密串',
    iv: '加密算法的初始向量',
    scope: 'all'
  }).then(resp=>{
      if(resp.success){
          console.log('authCode is ',resp.data)
      }else{
          console.log('err is ',resp.msg,'err code is ',resp.code)
      }
  }).catch(e=>{
    console.log(e)
  })
//获取用户信息
api.getUserInfo({
    scope: 'all'
  }).then(resp=>{
      if(resp.success){
          console.log('authCode is ',resp.data)
      }else{
          console.log('err is ',resp.msg,'err code is ',resp.code)
      }
  }).catch(e=>{
    console.log(e)
  })

API 说明


  /**
   * 发送埋点
   * @param typeId 埋点类型 eg:buyBtnClicked
   * @param data 埋点数据 eg:{ time: '2020-02-02' , user:'zhangsan' }
   */
  bury: (typeId: string, data?: Dict) => void;

  /**
   * 手机号注册
   * @param scope 接口调用业务code,当前传 all 即可
   * @param encryptedData 微信小程序获取手机号接口返回的加密数据
   * @param iv 加密算法的初始向量
   * @return BulterApiResponse<string> 参见 BulterApiResponse 说明
   * 示例:{
   *  code:200,
   *  success:true,
   *  message:'ok',
   *  data:'authCode' //使用此authCode调用我方后台接口获取用户信息,用户信息包括unionId,openId,phoneNumber,车牌号等
   * }
   */
  register: (params: {
    encryptedData: string;
    iv: string;
    scope: string;
  }) => Promise<BulterApiResponse<string>>;
  

  /**
   * 获取用户信息
   * @param scope 接口调用业务code,当前传 all 即可
   * @return BulterApiResponse<string> 参见 BulterApiResponse 说明
   * 示例:{
   *  code:200,
   *  success:true,
   *  message:'ok',
   *  data:'authCode' //使用此authCode调用我方后台接口获取用户信息,用户信息包括unionId,openId,phoneNumber,车牌号列表等
   * }
   */
  getUserInfo: (params: {
    scope: string;
  }) => Promise<BulterApiResponse<string>>;

  /**
   * 打开宿主小程序页面:
   * @param pageName:页面名称,必填
   * @param data:打开页面时传递的参数,可选
   * 目前可打开的页面:
   *  home:打开首页
   */
  openPage(pageName: string, data?: Dict);

BulterApiResponse

| 字段 | 类型 | 说明 | | ------------- |:-------:| :-----:| | success | Boolean | 接口调用是否成功 | | data | Any | 接口返回数据 | | msg | String | 失败时的错误提示 | | code | String | 接口调用的状态码(出错时凭此码与我方调试) | | traceId | String | 接口调用链路id |


change log

  • 1.0.5

    • 没有对外的更改
  • 1.0.4

    • BulterApiResponse:code 字段类型替换为String
    • BulterApiResponse:message 更改为 msg,含义不变
    • demo 添加异常处理