icms-api 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ import { PhotoContent } from './types/cms-photo';
6
6
  import { VideoContent } from './types/cms-video';
7
7
  import { ActivityContent } from './types/cms-activity';
8
8
  import { Reviews, SubscribeUser, ContactUs } from './types/cms-message';
9
- import { SpecDescription } from './types/cms-mall';
9
+ import { SpecDescription, GoodsItem, GoodsCategory, GoodsTag } from './types/cms-mall';
10
10
  import { ICookies } from './client-helper';
11
11
  export declare class ICMSClient {
12
12
  private cookies;
@@ -105,5 +105,19 @@ export declare class ICMSClient {
105
105
  loadFriendLinks(count?: number): Promise<Array<FriendLink>>;
106
106
  submitLink(data: Readonly<Pick<FriendLink, 'name' | 'url'> & Partial<Pick<FriendLink, 'description'>>>): Promise<boolean>;
107
107
  getSpecDescription(code: string): Promise<SpecDescription | undefined>;
108
+ /** 获取商品标签字典 */
109
+ loadGoodsTagList(): Promise<Array<GoodsTag>>;
110
+ /** 获取所有货架(类目)列表 */
111
+ loadGoodsShelves(): Promise<Array<GoodsCategory>>;
112
+ /** 获取指定货架的商品列表 */
113
+ loadCategoryGoods(params: Readonly<{
114
+ cateCode: string;
115
+ count?: number;
116
+ }>): Promise<Array<GoodsItem>>;
117
+ /** 分页搜索商品 */
118
+ searchGoods(params: Readonly<{
119
+ cateCode?: string;
120
+ keyword?: string;
121
+ } & PageParams>): Promise<PageInfo<GoodsItem> | undefined>;
108
122
  }
109
123
  export declare const icmsClient: ICMSClient;
@@ -7,7 +7,7 @@ import { PhotoContent } from './types/cms-photo';
7
7
  import { VideoContent } from './types/cms-video';
8
8
  import { ActivityContent } from './types/cms-activity';
9
9
  import { Reviews, SubscribeUser, ContactUs } from './types/cms-message';
10
- import { SpecDescription } from './types/cms-mall';
10
+ import { SpecDescription, GoodsItem, GoodsCategory, GoodsTag } from './types/cms-mall';
11
11
  export declare const helloURL: string;
12
12
  export declare class ICMSServer {
13
13
  private readonly http;
@@ -260,4 +260,18 @@ export declare class ICMSServer {
260
260
  * @param code 规格编码
261
261
  */
262
262
  getSpecDescription(code: string): Promise<SpecDescription | undefined>;
263
+ /** 获取商品标签字典 */
264
+ loadGoodsTagList(): Promise<Array<GoodsTag>>;
265
+ /** 获取所有货架(类目)列表 */
266
+ loadGoodsShelves(): Promise<Array<GoodsCategory>>;
267
+ /** 获取指定货架的商品列表 */
268
+ loadCategoryGoods(params: Readonly<{
269
+ cateCode: string;
270
+ count?: number;
271
+ }>): Promise<Array<GoodsItem>>;
272
+ /** 分页搜索商品 */
273
+ searchGoods(params: Readonly<{
274
+ cateCode?: string;
275
+ keyword?: string;
276
+ } & PageParams>): Promise<PageInfo<GoodsItem>>;
263
277
  }
@@ -12,3 +12,57 @@ export interface SpecDescription {
12
12
  /** JSON格式的额外属性 */
13
13
  props?: Record<string, string>;
14
14
  }
15
+ /** 商品图片 */
16
+ export interface GoodsImage {
17
+ id: string;
18
+ /** 图片地址 */
19
+ imageUrl: string;
20
+ /** 缩略图地址 */
21
+ thumbUrl?: string;
22
+ /** 图片名称 */
23
+ name?: string;
24
+ }
25
+ /** 商品视频 */
26
+ export interface GoodsVideo {
27
+ id?: string;
28
+ url?: string;
29
+ poster?: string;
30
+ }
31
+ /** 商品基础信息(用于列表展示) */
32
+ export interface GoodsItem {
33
+ id: string;
34
+ code: string;
35
+ name: string;
36
+ unitCode: string;
37
+ salePrice: number;
38
+ marketPrice: number;
39
+ description?: string;
40
+ images?: Array<GoodsImage>;
41
+ video?: GoodsVideo;
42
+ tags?: string;
43
+ hidden?: boolean;
44
+ createTime?: string;
45
+ lastUpdateTime?: string;
46
+ /** 货架编码 */
47
+ cateCode?: string;
48
+ /** 货架名称(后端 Transient 填充) */
49
+ cateName?: string;
50
+ }
51
+ /** 货架(商品类目) */
52
+ export interface GoodsCategory {
53
+ id: string;
54
+ /** 货架编码,格式 000-000-000-000-000 */
55
+ code: string;
56
+ name: string;
57
+ description?: string;
58
+ sortValue?: string;
59
+ /** 是否为叶子节点 */
60
+ leaf?: boolean;
61
+ }
62
+ /** 商品标签 */
63
+ export interface GoodsTag {
64
+ id: string;
65
+ code: string;
66
+ name: string;
67
+ websiteNo?: string;
68
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "icms-api",
3
3
  "private": false,
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "description": "对iCMS内容管理系统API的封装,使用该API能快速使用iCMS搭建您的WebApp!",
6
6
  "type": "module",
7
7
  "main": "./dist/icms-api.cjs.js",