@aurigma/axios-storefront-api-client

中文文档
2.69.3发布于 2026/11/05SEE LICENSE IN License.mdTypeScriptESM + CJS近 30 天下载 2865

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

中文使用文档
文档目录4 节
  1. 先决条件
  2. 使用量
  3. 节点Js
  4. 前端

Aurigma 客户 Canvas SDK - storefront API 客户端

这个模块是 Storefront API 的 Axios API 客户端,它是其中的一部分 顾客的相片 网络对打印系统. 您应该熟悉其服务并了解如何使用其API。 欲了解更多客户的Canvas及其服务,请参见: 获得其文件的起始部分。 。 。 .

API 客户端是自动生成的 NSwag 工具。如果由于任何原因,此 API 客户端对您不起作用,请自行使用 Swagger 文档生成它 客户的 Canvas API 网关。 。 。 .

先决条件

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

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

关于其他平台,请参见 后端服务 在客户的Canvas文档中的文章.

使用量

作为正则 npm 软件包安装 :

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

节点Js

如您所解释的那样,通过您的后端接收访问令牌 文档 把它交给你的应用程序.

const storefront = require("@aurigma/axios-storefront-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 方法:

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

const buildInfoClient = new storefront.BuildInfoApiClient(config);
const buildInfo = await buildInfoClient.getInfo();

const productSpecificationsApiClient =
  new storefront.ProductSpecificationsApiClient(config);
const productSpecifications = await productSpecificationsApiClient.getAll();

前端

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

import {
  ApiClientConfiguration,
  BuildInfoApiClient,
  ProductSpecificationsApiClient,
} from "@aurigma/axios-storefront-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 buildInfoClient = new BuildInfoApiClient(config);
buildInfoClient.getInfo().then((data) => console.log(data));

const productSpecificationsClient = new ProductSpecificationsApiClient(config);
productSpecificationsClient.getAll().then((data) => console.log(data));

为了解本模块中有哪些其他客户,请参见: 存储前置 API 参考。 。 。 .

注:每个客户的类名称形成为: 客户端NameApiClient, 例如: ApiClient, 例如 :. BuildInfo - > (中文) BuildInfoApiClient等 (中文(简体) ).

版本与发布记录

@aurigma/axios-storefront-api-client 共发布 79 个版本,首次发布于 2022/01/12;过去 12 个月发布了 8 个版本。

版本发布日期距今
2.69.3latest2026/11/052 天前
2.68.12026/09/032 个月前
2.66.62026/07/223 个月前
2.66.12026/07/024 个月前
2.65.12026/06/045 个月前
2.63.142026/04/166 个月前

关于 @aurigma/axios-storefront-api-client 的常见问题

@aurigma/axios-storefront-api-client 是什么?

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

如何安装 @aurigma/axios-storefront-api-client?

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

@aurigma/axios-storefront-api-client 支持 TypeScript 吗?

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

@aurigma/axios-storefront-api-client 支持 ESM 还是 CommonJS?

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

@aurigma/axios-storefront-api-client 可以商用吗?

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

@aurigma/axios-storefront-api-client 的下载量有多少?

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

@aurigma/axios-storefront-api-client 还在维护吗?

最新版本 2.69.3 发布于 2026/11/05(2 天前);至今共发布 79 个版本,其中过去 12 个月发布了 8 个;首次发布于 2022/01/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。