qing-client 0.0.19 → 0.0.20

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.
@@ -30,4 +30,71 @@ export declare class FileService extends BaseClient {
30
30
  * GET /api/files (网关转发到 /api/v1/files)
31
31
  */
32
32
  listFiles(query?: FileListQuery, options?: RequestOptions): Promise<PaginatedResponse<File>>;
33
+ /**
34
+ * 生成 OSS 上传签名
35
+ * POST /api/files/oss/generate-sign (网关转发到 /api/v1/files/oss/generate-sign)
36
+ */
37
+ generateOSSUploadSign(request: {
38
+ taskKey?: string;
39
+ fileName?: string;
40
+ fileSize?: number;
41
+ taskId?: string;
42
+ folderId?: string;
43
+ }, options?: RequestOptions): Promise<{
44
+ policy: string;
45
+ signature: string;
46
+ OSSAccessKeyId: string;
47
+ host: string;
48
+ expire: string;
49
+ callback?: string;
50
+ key: string;
51
+ taskId: string;
52
+ jwt: string;
53
+ projectId?: string;
54
+ }>;
55
+ /**
56
+ * 获取项目 OSS 配置
57
+ * GET /api/files/oss/config/:projectId (网关转发到 /api/v1/files/oss/config/:projectId)
58
+ */
59
+ getOSSConfig(projectId: string, options?: RequestOptions): Promise<any>;
60
+ /**
61
+ * 创建文件夹
62
+ * POST /api/files/folders (网关转发到 /api/v1/files/folders)
63
+ */
64
+ createFolder(request: {
65
+ name: string;
66
+ parentId?: string;
67
+ description?: string;
68
+ }, options?: RequestOptions): Promise<any>;
69
+ /**
70
+ * 获取文件夹详情
71
+ * GET /api/files/folders/:id (网关转发到 /api/v1/files/folders/:id)
72
+ */
73
+ getFolderById(folderId: string, options?: RequestOptions): Promise<any>;
74
+ /**
75
+ * 更新文件夹
76
+ * PUT /api/files/folders/:id (网关转发到 /api/v1/files/folders/:id)
77
+ */
78
+ updateFolder(folderId: string, updateData: {
79
+ name?: string;
80
+ description?: string;
81
+ parentId?: string;
82
+ }, options?: RequestOptions): Promise<any>;
83
+ /**
84
+ * 删除文件夹
85
+ * DELETE /api/files/folders/:id (网关转发到 /api/v1/files/folders/:id)
86
+ */
87
+ deleteFolder(folderId: string, options?: RequestOptions): Promise<{
88
+ message: string;
89
+ }>;
90
+ /**
91
+ * 获取文件夹列表
92
+ * GET /api/files/folders?parentId=xxx (网关转发到 /api/v1/files/folders?parentId=xxx)
93
+ */
94
+ listFolders(parentId?: string, options?: RequestOptions): Promise<any[]>;
95
+ /**
96
+ * 获取文件夹树
97
+ * GET /api/files/folders/tree?parentId=xxx (网关转发到 /api/v1/files/folders/tree?parentId=xxx)
98
+ */
99
+ getFolderTree(parentId?: string, options?: RequestOptions): Promise<any[]>;
33
100
  }
@@ -94,5 +94,100 @@ class FileService extends BaseClient_1.BaseClient {
94
94
  });
95
95
  return response;
96
96
  }
97
+ // ==================== OSS 相关接口 ====================
98
+ /**
99
+ * 生成 OSS 上传签名
100
+ * POST /api/files/oss/generate-sign (网关转发到 /api/v1/files/oss/generate-sign)
101
+ */
102
+ async generateOSSUploadSign(request, options) {
103
+ return this.request('/oss/generate-sign', {
104
+ ...options,
105
+ method: 'POST',
106
+ body: request
107
+ });
108
+ }
109
+ /**
110
+ * 获取项目 OSS 配置
111
+ * GET /api/files/oss/config/:projectId (网关转发到 /api/v1/files/oss/config/:projectId)
112
+ */
113
+ async getOSSConfig(projectId, options) {
114
+ return this.request(`/oss/config/${projectId}`, {
115
+ ...options,
116
+ method: 'GET'
117
+ });
118
+ }
119
+ // ==================== 文件夹相关接口 ====================
120
+ /**
121
+ * 创建文件夹
122
+ * POST /api/files/folders (网关转发到 /api/v1/files/folders)
123
+ */
124
+ async createFolder(request, options) {
125
+ return this.request('/folders', {
126
+ ...options,
127
+ method: 'POST',
128
+ body: request
129
+ });
130
+ }
131
+ /**
132
+ * 获取文件夹详情
133
+ * GET /api/files/folders/:id (网关转发到 /api/v1/files/folders/:id)
134
+ */
135
+ async getFolderById(folderId, options) {
136
+ return this.request(`/folders/${folderId}`, {
137
+ ...options,
138
+ method: 'GET'
139
+ });
140
+ }
141
+ /**
142
+ * 更新文件夹
143
+ * PUT /api/files/folders/:id (网关转发到 /api/v1/files/folders/:id)
144
+ */
145
+ async updateFolder(folderId, updateData, options) {
146
+ return this.request(`/folders/${folderId}`, {
147
+ ...options,
148
+ method: 'PUT',
149
+ body: updateData
150
+ });
151
+ }
152
+ /**
153
+ * 删除文件夹
154
+ * DELETE /api/files/folders/:id (网关转发到 /api/v1/files/folders/:id)
155
+ */
156
+ async deleteFolder(folderId, options) {
157
+ return this.request(`/folders/${folderId}`, {
158
+ ...options,
159
+ method: 'DELETE'
160
+ });
161
+ }
162
+ /**
163
+ * 获取文件夹列表
164
+ * GET /api/files/folders?parentId=xxx (网关转发到 /api/v1/files/folders?parentId=xxx)
165
+ */
166
+ async listFolders(parentId, options) {
167
+ const params = {};
168
+ if (parentId !== undefined) {
169
+ params.parentId = parentId;
170
+ }
171
+ return this.request('/folders', {
172
+ ...options,
173
+ method: 'GET',
174
+ params
175
+ });
176
+ }
177
+ /**
178
+ * 获取文件夹树
179
+ * GET /api/files/folders/tree?parentId=xxx (网关转发到 /api/v1/files/folders/tree?parentId=xxx)
180
+ */
181
+ async getFolderTree(parentId, options) {
182
+ const params = {};
183
+ if (parentId !== undefined) {
184
+ params.parentId = parentId;
185
+ }
186
+ return this.request('/folders/tree', {
187
+ ...options,
188
+ method: 'GET',
189
+ params
190
+ });
191
+ }
97
192
  }
98
193
  exports.FileService = FileService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qing-client",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {