@ecomplus/client

中文文档
2.4.0发布于 2024/10/09MITESM + CJS近 30 天下载 5729

JS client for E-Com Plus REST APIs

原始使用文档
文档目录6 节
  1. Usage
  2. Store API request example
  3. Dependencies
  4. Development
  5. Contributing
  6. Deploy

E-Com Plus Client

Publish CodeFactor npm version License MIT

JS client for E-Com Plus REST APIs

CHANGELOG

Usage

TL;DR: We have methods to run requests for almost all E-Com Plus APIs, but you're probably searching for Store API.

The @ecomplus/client package provides a list of methods, each one is a function to request a specific E-Com Plus REST API, using axios HTTP client and returning a Promise.

It's available for both Node.js and browser environments.

Store API request example

import { store } from '@ecomplus/client'

const authenticationId = 'myAuthenticationId'
const accessToken = 'myAccessToken'

ecomClient.store({
  url: '/products.json',
  authenticationId,
  accessToken,
  method: 'post',
  data: { sku: '123', name: 'Sample Prduct 123' }
})
  .then(({ data, status }) => console.log(status, data))
  .catch(error => console.error(error))

Dependencies

It requires and may not include core-js, axios and @ecomplus/utils.

Node.js

npm i --save @ecomplus/utils @ecomplus/client

Webpack

npm i --save core-js @ecomplus/utils @ecomplus/client

CDN

<script src="https://cdn.jsdelivr.net/npm/@ecomplus/client/dist/ecom-client.polyfill.min.js"></script>

axios and ecomUtils libraries must be included separately and available on window scope.

Development

Fork/clone this repository and install dependencies normally:

git clone https://github.com/ecomplus/client
cd client
npm i

Then you can edit source files and test locally with npm run serve.

Contributing

Please read the contribution guidelines.

Deploy

Take a look on package.json scripts:

  • npm run doc - Update jsdoc/docdash generated documentation;
  • npm run release - Generate changelog and new version;

版本与发布记录

@ecomplus/client 共发布 36 个版本,首次发布于 2019/07/06;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.4.0latest2024/10/092 年前
2.3.12024/03/232 年前
2.2.12021/03/115 年前
2.2.02021/01/255 年前
2.1.42021/01/075 年前
2.1.32020/10/306 年前

关于 @ecomplus/client 的常见问题

@ecomplus/client 是什么?

JS client for E-Com Plus REST APIs

如何安装 @ecomplus/client?

在项目目录运行 npm install @ecomplus/client,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@ecomplus/utils(1.x)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ecomplus/client 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/ecomplus__client 是否存在。

@ecomplus/client 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ecomplus/client 可以商用吗?

@ecomplus/client 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ecomplus/client 的下载量有多少?

根据 npm 官方下载统计,@ecomplus/client 在 2026/10/13 – 2026/11/11 这 30 天内被下载 5,729 次,日均约 191 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ecomplus/client 还在维护吗?

最新版本 2.4.0 发布于 2024/10/09(2 年前);至今共发布 36 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/07/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。