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

obelisk-card-sdk

v1.0.2

Published

方尖碑发卡系统供应商API SDK for Node.js

Downloads

4

Readme

方尖碑发卡系统供应商API SDK - Node.js

安装

方式1:直接使用文件(推荐)

下载 SDK 压缩包并解压后,直接使用:

const ObeliskCardSDK = require('./index.js');

方式2:本地安装

在项目目录下:

npm install ./path/to/sdk

或者将 SDK 文件复制到项目中,然后在 package.json 中添加:

{
  "dependencies": {
    "obelisk-card-sdk": "file:./path/to/sdk"
  }
}

然后运行:

npm install

方式3:从 npm 安装(推荐)✅

npm install obelisk-card-sdk

✅ SDK 已发布到 npm! 您可以直接使用 npm 安装。

查看包信息:https://www.npmjs.com/package/obelisk-card-sdk

方式4:安装依赖

SDK 需要以下依赖:

npm install axios

注意:crypto 是 Node.js 内置模块,无需安装。

快速开始

const ObeliskCardSDK = require('obelisk-card-sdk');

// 初始化SDK
const sdk = new ObeliskCardSDK({
  apiKey: 'YOUR_API_KEY',
  apiSecret: 'YOUR_API_SECRET',
  baseUrl: 'https://api.example.com'
});

// 获取商品分类列表
async function example() {
  try {
    const groups = await sdk.getGroups();
    console.log('分类列表:', groups);
    
    // 获取商品列表
    const products = await sdk.getProducts({ groupId: 1, page: 1, limit: 20 });
    console.log('商品列表:', products);
    
    // 采购商品
    const order = await sdk.purchaseProduct({
      productId: 1,
      quantity: 1,
      externalOrderSn: 'ORDER_123456'
    });
    console.log('订单信息:', order);
  } catch (error) {
    console.error('错误:', error.message);
  }
}

example();

API 方法

getGroups(params)

获取商品分类列表

参数:

  • params.page (number, 可选) - 页码
  • params.limit (number, 可选) - 每页数量

返回: Promise<{ groups: Array }>

getProducts(params)

获取商品列表

参数:

  • params.groupId (number, 可选) - 分类ID
  • params.page (number, 可选) - 页码
  • params.limit (number, 可选) - 每页数量

返回: Promise<{ products: Array, total: number, page: number, limit: number }>

batchGetProducts(data)

批量获取商品

参数:

  • data.products (Array<{productId: number, groupId?: number}>) - 商品查询列表(最多100个),每个元素包含productId(必需)和可选的groupId

返回: Promise<{ products: Array }>

getBalance(params)

查询余额

参数:

  • params.currency (string, 可选) - 显示货币(如:USDT、CNY)

返回: Promise<{ balance: number, currency: string }>

purchaseProduct(data)

采购商品

参数:

  • data.productId (number) - 商品ID
  • data.quantity (number) - 购买数量
  • data.externalOrderSn (string, 可选) - 外部订单号

返回: Promise<{ orderSn: string, status: string, carmis: Array<string> }>

getOrder(orderSn)

查询订单

参数:

  • orderSn (string) - 订单号(系统订单号或外部订单号)

返回: Promise<{ orderSn: string, status: string, carmis: Array<string> }>

getOrders(params)

获取订单列表

参数:

  • params.page (number, 可选) - 页码
  • params.limit (number, 可选) - 每页数量
  • params.status (number, 可选) - 订单状态

返回: Promise<{ orders: Array, total: number, page: number, limit: number }>

错误处理

所有方法在请求失败时会抛出错误,请使用 try-catch 捕获:

try {
  const result = await sdk.getProducts();
} catch (error) {
  console.error('请求失败:', error.message);
}

许可证

MIT