# @aurigma/axios-storefront-products-api-client 中文文档

规范地址：https://npmcn.com/package/%40aurigma/axios-storefront-products-api-client/

版本：2\.54\.34
npm 元数据更新时间：2026-01-22T08:00:17.643Z
中文译文更新时间：2026-11-07T05:18:33.965Z
软件包许可：SEE LICENSE IN License\.md

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40aurigma/axios-storefront-products-api-client
原文对照：https://npmcn.com/package/%40aurigma/axios-storefront-products-api-client/?lang=original
项目主页：https://customerscanvas.com/

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：609 kB，9 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：1 个
- peer 依赖：axios ^1\.1\.3
- 首次发布：2022-06-03T05:44:22.061Z
- 最新版本发布：2025-06-23T07:23:39.523Z
- 近 30 天下载量：2576（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：55（近 12 个月 0 个）

## 中文简介

Axios API 客户端为客户端 Canvas网络对打印系统的 Storefront API服务.

## 安装

```sh
npm install @aurigma/axios-storefront-products-api-client
```

也可以使用：`pnpm add @aurigma/axios-storefront-products-api-client`、`yarn add @aurigma/axios-storefront-products-api-client`、`bun add @aurigma/axios-storefront-products-api-client`

## README

# Aurigma 客户 Canvas SDK - storefront API 客户端

此模块是 Storefront API 服务的 Axios API 客户端,属于 [**顾客的相片**](https://customerscanvas.com/) 网络对打印系统. 您应该熟悉其服务并了解如何使用其API。 欲了解更多客户的Canvas及其服务,请参见: [获得其文件的起始部分](https://customerscanvas.com/dev/getting-started/intro.html)。 。 。 .

API 客户端是自动生成的 [NSwag 工具](https://github.com/RicoSuter/NSwag)。如果由于任何原因,此 API 客户端对您不起作用,请自行使用 Swagger 文档生成它 [客户的 Canvas API 网关](https://api.customerscanvashub.com/)。 。 。 .

## 先决条件

要能够使用此软件包,需要满足以下要求: 1

-   你一定有客户的账户.
-   您需要在 Javascript\\ Typescript 应用程序中使用它 .

关于其他平台,请参见 [后端服务](https://customerscanvas.com/dev/getting-started/about-backend-services.html) 在客户的Canvas文档中的文章.

## 使用量

作为正则 npm 软件包安装 :

```
npm install @aurigma/axios-storefront-products-api-client
```

### 节点Js

如您所解释的那样,通过您的后端接收访问令牌 [文档](https://customerscanvas.com/dev/getting-started/about-backend-services.html#authorization) 把它交给你的应用程序.

```js
const storefront = require("@aurigma/axios-storefront-products-api-client");
const axios = require("axios").default;

// You need to create external app in BackOffice with required scopes to receive clientId\clientSecret
// https://customerscanvas.com/dev/getting-started/about-backend-services.html#authorization
const clientId = "";
const clientSecret = "";
const apiUrl = "https://api.customerscanvashub.com/";

const getToken = async (clientId, clientSecret) => {
  const requestConfig = {
    method: "post",
    url: apiUrl + "connect/token",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    data: new URLSearchParams({
      client_id: clientId,
      client_secret: clientSecret,
      grant_type: "client_credentials",
    }),
  };

  const response = await axios(requestConfig);
  return response.data["access_token"];
};

const token = await getToken(clientId, clientSecret);
```

然后用这个符号调用 ApiClients 方法:

```js
const config = new storefront.ApiClientConfiguration();
config.apiUrl = apiUrl;
config.setAuthorizationToken(token);

const productsApiClient =
  new storefront.ProductsApiClient(config);
const products = await productsApiClient.getAllProducts();
```

### 前端

你应该从你的后端取回访问令牌 上面怎么解释的.

```ts
import {
  ApiClientConfiguration,
  ProductsApiClient,
} from "@aurigma/axios-storefront-products-api-client";

// A token should be received from your backend
const token = "";
// In general you can use "https://api.customerscanvashub.com" as a base api url.
// But this url may be different for on-premises version of Customer's Canvas
const baseApiUrl = "https://api.customerscanvashub.com";

const config = new ApiClientConfiguration();
config.apiUrl = baseApiUrl;
config.setAuthorizationToken(token);

const productsClient = new ProductsApiClient(config);
productsClient.getAllProducts().then((data) => console.log(data));
```

为了解本模块中有哪些其他客户,请参见: [存储前置 API 参考](https://customerscanvas.com/dev/backend/backend/api/StorefrontApi.OpenApi2.html)。 。 。 .

> 注:每个客户的类名称形成为: _客户端Name_ApiClient, 例如: ApiClient, 例如 :. `Products` - > (中文) `ProductsApiClient`等 (中文(简体) ).

## 常见问题

### @aurigma/axios-storefront-products-api-client 是什么？

Axios API 客户端为客户端 Canvas网络对打印系统的 Storefront API服务\.

### 如何安装 @aurigma/axios-storefront-products-api-client？

在项目目录运行 npm install @aurigma/axios-storefront-products-api-client，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：axios（^1\.1\.3）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @aurigma/axios-storefront-products-api-client 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @aurigma/axios-storefront-products-api-client 支持 ESM 还是 CommonJS？

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

### @aurigma/axios-storefront-products-api-client 可以商用吗？

@aurigma/axios-storefront-products-api-client 使用 SEE LICENSE IN License\.md 许可。许可条款写在包内的独立文件中，请阅读该文件确认可否商用。以上为概括，不构成法律意见，请以许可原文为准。

### @aurigma/axios-storefront-products-api-client 的下载量有多少？

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

### @aurigma/axios-storefront-products-api-client 还在维护吗？

最新版本 2\.54\.34 发布于 2025/06/23（1\.4 年前）；至今共发布 55 个版本，其中过去 12 个月发布了 0 个；首次发布于 2022/06/03。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

