@gt6/sdk 1.0.4 → 1.0.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.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  import { GT6Client } from './core/client';
2
2
  import { ArticlesAPI } from './modules/articles';
3
- import { GT6Config, ArticlesByCategoryOptions, ArticlesByTagOptions } from './core/types';
3
+ import { ProductsAPI } from './modules/products';
4
+ import { GT6Config, ArticlesByCategoryOptions, ArticlesByTagOptions, ProductsByCategoryOptions, ProductsByTagOptions } from './core/types';
4
5
  /**
5
6
  * GT6 SDK 主类
6
- * 提供文章管理相关的所有功能
7
+ * 提供文章和产品管理相关的所有功能
7
8
  */
8
9
  export declare class GT6SDK {
9
10
  articles: ArticlesAPI;
11
+ products: ProductsAPI;
10
12
  constructor(config: GT6Config);
11
13
  /**
12
14
  * 获取客户端实例(用于高级用法)
@@ -81,9 +83,77 @@ export declare class GT6SDK {
81
83
  total: number;
82
84
  depth: number;
83
85
  }>;
86
+ /**
87
+ * 8. 便捷方法:根据产品ID获取产品详情
88
+ */
89
+ getProduct(productId: number | string): Promise<import("./core/types").Product>;
90
+ /**
91
+ * 9. 便捷方法:获取产品分类列表
92
+ */
93
+ getProductCategories(productRootCategoryId?: number | string): Promise<import("./core/types").ProductCategory[]>;
94
+ /**
95
+ * 10. 便捷方法:获取产品标签列表
96
+ */
97
+ getProductTags(productTagAlias?: string): Promise<import("./core/types").ProductTag[]>;
98
+ /**
99
+ * 11. 便捷方法:根据分类ID获取产品列表
100
+ */
101
+ getProductsByCategory(categoryId: number | number[], options?: ProductsByCategoryOptions): Promise<{
102
+ products: import("./core/types").Product[];
103
+ total: number;
104
+ page: number;
105
+ limit: number;
106
+ }>;
107
+ /**
108
+ * 12. 便捷方法:根据标签ID获取产品列表
109
+ */
110
+ getProductsByTag(tagId: number | number[], options?: ProductsByTagOptions): Promise<{
111
+ products: import("./core/types").Product[];
112
+ total: number;
113
+ page: number;
114
+ limit: number;
115
+ }>;
116
+ /**
117
+ * 13. 便捷方法:根据分类ID获取该分类的层级路径
118
+ */
119
+ getProductCategoryPath(categoryId: number): Promise<{
120
+ path: import("./core/types").ProductCategory[];
121
+ currentCategory: import("./core/types").ProductCategory | null;
122
+ breadcrumbs: Array<{
123
+ categoryId: number;
124
+ categoryName: string;
125
+ level: number;
126
+ }>;
127
+ }>;
128
+ /**
129
+ * 14. 便捷方法:获取指定分类ID下的子分类
130
+ */
131
+ getProductSubCategories(categoryId: number, options?: {
132
+ recursive?: boolean;
133
+ includeCurrent?: boolean;
134
+ maxDepth?: number;
135
+ }): Promise<{
136
+ subCategories: import("./core/types").ProductCategory[];
137
+ currentCategory: import("./core/types").ProductCategory | null;
138
+ total: number;
139
+ depth: number;
140
+ }>;
141
+ /**
142
+ * 15. 便捷方法:获取税费信息
143
+ */
144
+ getTaxInfo(): Promise<import("./core/types").TaxResponse>;
145
+ /**
146
+ * 16. 便捷方法:获取运费信息
147
+ */
148
+ getShippingInfo(): Promise<import("./core/types").ShippingResponse>;
149
+ /**
150
+ * 17. 便捷方法:获取区域信息
151
+ */
152
+ getRegions(): Promise<import("./core/types").RegionResponse>;
84
153
  }
85
154
  export * from './core/types';
86
155
  export * from './core/client';
87
156
  export * from './modules/articles';
157
+ export * from './modules/products';
88
158
  export default GT6SDK;
89
159
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE1F;;;GAGG;AACH,qBAAa,MAAM;IACV,QAAQ,EAAE,WAAW,CAAC;gBAEjB,MAAM,EAAE,SAAS;IAK7B;;OAEG;IACH,S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E;;OAEG;IACG,sBAAsB,CAAC,UAAU,EAAE,MAAM;;;;;;;;;IAI/C;;OAEG;IACG,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;;;;;;IAID;;OAEG;IACG,UAAU;IAIhB;;OAEG;IACG,eAAe;IAIrB;;OAEG;IACG,UAAU;CAGjB;AAGD,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAGnC,eAAe,MAAM,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { GT6Client } from '../core/client';
2
+ import { Product, ProductCategory, ProductTag, ProductsByTagOptions, ProductsByCategoryOptions, TaxResponse, ShippingResponse, RegionResponse } from '../core/types';
3
+ export declare class ProductsAPI {
4
+ private client;
5
+ constructor(client: GT6Client);
6
+ /**
7
+ * 1. 根据产品ID获取产品详情
8
+ */
9
+ getProduct(productId: number | string): Promise<Product>;
10
+ /**
11
+ * 2. 获取产品分类列表
12
+ */
13
+ getCategories(productRootCategoryId?: number | string): Promise<ProductCategory[]>;
14
+ /**
15
+ * 3. 获取产品标签列表
16
+ */
17
+ getTags(productTagAlias?: string): Promise<ProductTag[]>;
18
+ /**
19
+ * 4. 根据分类ID获取产品列表
20
+ * 支持单个分类ID或分类ID数组
21
+ */
22
+ getProductsByCategory(categoryId: number | number[], options?: ProductsByCategoryOptions): Promise<{
23
+ products: Product[];
24
+ total: number;
25
+ page: number;
26
+ limit: number;
27
+ }>;
28
+ /**
29
+ * 5. 根据标签ID获取产品列表
30
+ * 支持单个标签ID或标签ID数组
31
+ */
32
+ getProductsByTag(tagId: number | number[], options?: ProductsByTagOptions): Promise<{
33
+ products: Product[];
34
+ total: number;
35
+ page: number;
36
+ limit: number;
37
+ }>;
38
+ /**
39
+ * 6. 根据分类ID获取该分类的层级路径
40
+ * 用于前端面包屑导航
41
+ */
42
+ getCategoryPath(categoryId: number): Promise<{
43
+ path: ProductCategory[];
44
+ currentCategory: ProductCategory | null;
45
+ breadcrumbs: Array<{
46
+ categoryId: number;
47
+ categoryName: string;
48
+ level: number;
49
+ }>;
50
+ }>;
51
+ /**
52
+ * 7. 获取指定分类ID下的子分类
53
+ * 支持递归获取所有层级的子分类
54
+ */
55
+ getSubCategories(categoryId: number, options?: {
56
+ recursive?: boolean;
57
+ includeCurrent?: boolean;
58
+ maxDepth?: number;
59
+ }): Promise<{
60
+ subCategories: ProductCategory[];
61
+ currentCategory: ProductCategory | null;
62
+ total: number;
63
+ depth: number;
64
+ }>;
65
+ /**
66
+ * 8. 获取税费信息
67
+ * 获取平台的所有税费模板和规则
68
+ */
69
+ getTaxInfo(): Promise<TaxResponse>;
70
+ /**
71
+ * 9. 获取运费信息
72
+ * 获取平台的所有运费模板和规则
73
+ */
74
+ getShippingInfo(): Promise<ShippingResponse>;
75
+ /**
76
+ * 10. 获取区域信息
77
+ * 获取平台的所有区域信息,包括层级结构
78
+ */
79
+ getRegions(): Promise<RegionResponse>;
80
+ }
81
+ //# sourceMappingURL=products.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/modules/products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,OAAO,EACP,eAAe,EACf,UAAU,EAGV,oBAAoB,EACpB,yBAAyB,EACzB,WAAW,EACX,gBAAgB,EAChB,cAAc,EACf,MAAM,eAAe,CAAC;AAEvB,qBAAa,WAAW;IACV,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;OAEG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAkE9D;;OAEG;IACG,a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;QACjC,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;QACxC,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAqFF;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC;IAKxC;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAKlD;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC;CAI5C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gt6/sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "GT6 SDK for articles management - A comprehensive JavaScript/TypeScript library for managing articles, categories, and tags in GT6 platform",
5
5
  "type": "module",
6
6
  "main": "dist/gt6-sdk.cjs.js",