qing-client 0.0.32 → 0.0.33
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/lib/service/OrgService.d.ts +61 -19
- package/lib/service/OrgService.js +107 -21
- package/lib/types/org.d.ts +54 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseClient } from "../client/BaseClient";
|
|
2
2
|
import { ClientConfig, RequestOptions } from "../types";
|
|
3
|
-
import { Organization, CreateOrganizationRequest, UpdateOrganizationRequest, OrganizationListQuery, OrganizationListResponse, Project, Application, ProjectAppsResponse, OrgResolutionRule, CreateOrgResolutionRuleRequest, UpdateOrgResolutionRuleRequest, OrgResolutionRuleListQuery, OrgResolutionRuleListResponse, OrgResolveRequest, OrgResolveResponse, ProjectsSyncRequest, ProjectsSyncResponse } from "../types/org";
|
|
3
|
+
import { Organization, CreateOrganizationRequest, UpdateOrganizationRequest, OrganizationListQuery, OrganizationListResponse, Project, CreateProjectRequest, UpdateProjectRequest, ProjectListQuery, ProjectListResponse, Application, CreateApplicationRequest, UpdateApplicationRequest, ApplicationListQuery, ApplicationListResponse, ProjectAppsResponse, OrgResolutionRule, CreateOrgResolutionRuleRequest, UpdateOrgResolutionRuleRequest, OrgResolutionRuleListQuery, OrgResolutionRuleListResponse, OrgResolveRequest, OrgResolveResponse, ProjectsSyncRequest, ProjectsSyncResponse } from "../types/org";
|
|
4
4
|
/**
|
|
5
5
|
* 组织感知服务(Org-Aware Service)
|
|
6
6
|
*
|
|
@@ -32,32 +32,53 @@ export declare class OrgService extends BaseClient {
|
|
|
32
32
|
* GET /apps/:configId
|
|
33
33
|
*/
|
|
34
34
|
getApp(configId: string, options?: RequestOptions): Promise<Application>;
|
|
35
|
+
/**
|
|
36
|
+
* [Admin] 获取项目列表(包含 disabled)
|
|
37
|
+
* GET /admin/projects
|
|
38
|
+
*/
|
|
39
|
+
adminListProjects(query?: ProjectListQuery, options?: RequestOptions): Promise<ProjectListResponse>;
|
|
35
40
|
/**
|
|
36
41
|
* [Admin] 获取项目详情(包含 disabled)
|
|
37
|
-
* GET /admin/projects/:
|
|
42
|
+
* GET /admin/projects/:id
|
|
43
|
+
*/
|
|
44
|
+
adminGetProject(id: string, options?: RequestOptions): Promise<Project>;
|
|
45
|
+
/**
|
|
46
|
+
* [Admin] 创建项目
|
|
47
|
+
* POST /admin/projects
|
|
48
|
+
*/
|
|
49
|
+
adminCreateProject(request: CreateProjectRequest, options?: RequestOptions): Promise<Project>;
|
|
50
|
+
/**
|
|
51
|
+
* [Admin] 更新项目
|
|
52
|
+
* PATCH /admin/projects/:id
|
|
38
53
|
*/
|
|
39
|
-
|
|
54
|
+
adminUpdateProject(id: string, request: UpdateProjectRequest, options?: RequestOptions): Promise<Project>;
|
|
55
|
+
/**
|
|
56
|
+
* [Admin] 删除项目
|
|
57
|
+
* DELETE /admin/projects/:id
|
|
58
|
+
*/
|
|
59
|
+
adminDeleteProject(id: string, options?: RequestOptions): Promise<{
|
|
60
|
+
ok: boolean;
|
|
61
|
+
id: string;
|
|
62
|
+
}>;
|
|
40
63
|
/**
|
|
41
64
|
* [Admin] 获取项目下所有应用(包含 disabled)
|
|
42
|
-
* GET /admin/projects/:
|
|
65
|
+
* GET /admin/projects/:id/apps
|
|
43
66
|
*/
|
|
44
|
-
adminGetProjectApps(
|
|
67
|
+
adminGetProjectApps(id: string, options?: RequestOptions): Promise<ProjectAppsResponse>;
|
|
45
68
|
/**
|
|
46
69
|
* [Admin] 启用项目
|
|
47
|
-
* POST /admin/projects/:
|
|
70
|
+
* POST /admin/projects/:id/enable
|
|
48
71
|
*/
|
|
49
|
-
adminEnableProject(
|
|
72
|
+
adminEnableProject(id: string, options?: RequestOptions): Promise<{
|
|
50
73
|
ok: boolean;
|
|
51
|
-
configId: string;
|
|
52
74
|
id: string;
|
|
53
75
|
}>;
|
|
54
76
|
/**
|
|
55
77
|
* [Admin] 禁用项目
|
|
56
|
-
* POST /admin/projects/:
|
|
78
|
+
* POST /admin/projects/:id/disable
|
|
57
79
|
*/
|
|
58
|
-
adminDisableProject(
|
|
80
|
+
adminDisableProject(id: string, options?: RequestOptions): Promise<{
|
|
59
81
|
ok: boolean;
|
|
60
|
-
configId: string;
|
|
61
82
|
id: string;
|
|
62
83
|
}>;
|
|
63
84
|
/**
|
|
@@ -65,27 +86,48 @@ export declare class OrgService extends BaseClient {
|
|
|
65
86
|
* POST /admin/projects/sync
|
|
66
87
|
*/
|
|
67
88
|
adminSyncProjects(request: ProjectsSyncRequest, options?: RequestOptions): Promise<ProjectsSyncResponse>;
|
|
89
|
+
/**
|
|
90
|
+
* [Admin] 获取应用列表(包含 disabled)
|
|
91
|
+
* GET /admin/apps
|
|
92
|
+
*/
|
|
93
|
+
adminListApps(query?: ApplicationListQuery, options?: RequestOptions): Promise<ApplicationListResponse>;
|
|
68
94
|
/**
|
|
69
95
|
* [Admin] 获取应用详情(包含 disabled)
|
|
70
|
-
* GET /admin/apps/:
|
|
96
|
+
* GET /admin/apps/:id
|
|
97
|
+
*/
|
|
98
|
+
adminGetApp(id: string, options?: RequestOptions): Promise<Application>;
|
|
99
|
+
/**
|
|
100
|
+
* [Admin] 创建应用
|
|
101
|
+
* POST /admin/apps
|
|
102
|
+
*/
|
|
103
|
+
adminCreateApp(request: CreateApplicationRequest, options?: RequestOptions): Promise<Application>;
|
|
104
|
+
/**
|
|
105
|
+
* [Admin] 更新应用
|
|
106
|
+
* PATCH /admin/apps/:id
|
|
71
107
|
*/
|
|
72
|
-
|
|
108
|
+
adminUpdateApp(id: string, request: UpdateApplicationRequest, options?: RequestOptions): Promise<Application>;
|
|
109
|
+
/**
|
|
110
|
+
* [Admin] 删除应用
|
|
111
|
+
* DELETE /admin/apps/:id
|
|
112
|
+
*/
|
|
113
|
+
adminDeleteApp(id: string, options?: RequestOptions): Promise<{
|
|
114
|
+
ok: boolean;
|
|
115
|
+
id: string;
|
|
116
|
+
}>;
|
|
73
117
|
/**
|
|
74
118
|
* [Admin] 启用应用
|
|
75
|
-
* POST /admin/apps/:
|
|
119
|
+
* POST /admin/apps/:id/enable
|
|
76
120
|
*/
|
|
77
|
-
adminEnableApp(
|
|
121
|
+
adminEnableApp(id: string, options?: RequestOptions): Promise<{
|
|
78
122
|
ok: boolean;
|
|
79
|
-
configId: string;
|
|
80
123
|
id: string;
|
|
81
124
|
}>;
|
|
82
125
|
/**
|
|
83
126
|
* [Admin] 禁用应用
|
|
84
|
-
* POST /admin/apps/:
|
|
127
|
+
* POST /admin/apps/:id/disable
|
|
85
128
|
*/
|
|
86
|
-
adminDisableApp(
|
|
129
|
+
adminDisableApp(id: string, options?: RequestOptions): Promise<{
|
|
87
130
|
ok: boolean;
|
|
88
|
-
configId: string;
|
|
89
131
|
id: string;
|
|
90
132
|
}>;
|
|
91
133
|
/**
|
|
@@ -60,42 +60,85 @@ class OrgService extends BaseClient_1.BaseClient {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
// ==================== Admin: Project ====================
|
|
63
|
+
/**
|
|
64
|
+
* [Admin] 获取项目列表(包含 disabled)
|
|
65
|
+
* GET /admin/projects
|
|
66
|
+
*/
|
|
67
|
+
async adminListProjects(query, options) {
|
|
68
|
+
return this.request("/admin/projects", {
|
|
69
|
+
...options,
|
|
70
|
+
method: "GET",
|
|
71
|
+
params: query,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
63
74
|
/**
|
|
64
75
|
* [Admin] 获取项目详情(包含 disabled)
|
|
65
|
-
* GET /admin/projects/:
|
|
76
|
+
* GET /admin/projects/:id
|
|
66
77
|
*/
|
|
67
|
-
async adminGetProject(
|
|
68
|
-
return this.request(`/admin/projects/${
|
|
78
|
+
async adminGetProject(id, options) {
|
|
79
|
+
return this.request(`/admin/projects/${id}`, {
|
|
69
80
|
...options,
|
|
70
81
|
method: "GET",
|
|
71
82
|
});
|
|
72
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* [Admin] 创建项目
|
|
86
|
+
* POST /admin/projects
|
|
87
|
+
*/
|
|
88
|
+
async adminCreateProject(request, options) {
|
|
89
|
+
return this.request("/admin/projects", {
|
|
90
|
+
...options,
|
|
91
|
+
method: "POST",
|
|
92
|
+
body: request,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* [Admin] 更新项目
|
|
97
|
+
* PATCH /admin/projects/:id
|
|
98
|
+
*/
|
|
99
|
+
async adminUpdateProject(id, request, options) {
|
|
100
|
+
return this.request(`/admin/projects/${id}`, {
|
|
101
|
+
...options,
|
|
102
|
+
method: "PATCH",
|
|
103
|
+
body: request,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* [Admin] 删除项目
|
|
108
|
+
* DELETE /admin/projects/:id
|
|
109
|
+
*/
|
|
110
|
+
async adminDeleteProject(id, options) {
|
|
111
|
+
return this.request(`/admin/projects/${id}`, {
|
|
112
|
+
...options,
|
|
113
|
+
method: "DELETE",
|
|
114
|
+
});
|
|
115
|
+
}
|
|
73
116
|
/**
|
|
74
117
|
* [Admin] 获取项目下所有应用(包含 disabled)
|
|
75
|
-
* GET /admin/projects/:
|
|
118
|
+
* GET /admin/projects/:id/apps
|
|
76
119
|
*/
|
|
77
|
-
async adminGetProjectApps(
|
|
78
|
-
return this.request(`/admin/projects/${
|
|
120
|
+
async adminGetProjectApps(id, options) {
|
|
121
|
+
return this.request(`/admin/projects/${id}/apps`, {
|
|
79
122
|
...options,
|
|
80
123
|
method: "GET",
|
|
81
124
|
});
|
|
82
125
|
}
|
|
83
126
|
/**
|
|
84
127
|
* [Admin] 启用项目
|
|
85
|
-
* POST /admin/projects/:
|
|
128
|
+
* POST /admin/projects/:id/enable
|
|
86
129
|
*/
|
|
87
|
-
async adminEnableProject(
|
|
88
|
-
return this.request(`/admin/projects/${
|
|
130
|
+
async adminEnableProject(id, options) {
|
|
131
|
+
return this.request(`/admin/projects/${id}/enable`, {
|
|
89
132
|
...options,
|
|
90
133
|
method: "POST",
|
|
91
134
|
});
|
|
92
135
|
}
|
|
93
136
|
/**
|
|
94
137
|
* [Admin] 禁用项目
|
|
95
|
-
* POST /admin/projects/:
|
|
138
|
+
* POST /admin/projects/:id/disable
|
|
96
139
|
*/
|
|
97
|
-
async adminDisableProject(
|
|
98
|
-
return this.request(`/admin/projects/${
|
|
140
|
+
async adminDisableProject(id, options) {
|
|
141
|
+
return this.request(`/admin/projects/${id}/disable`, {
|
|
99
142
|
...options,
|
|
100
143
|
method: "POST",
|
|
101
144
|
});
|
|
@@ -112,32 +155,75 @@ class OrgService extends BaseClient_1.BaseClient {
|
|
|
112
155
|
});
|
|
113
156
|
}
|
|
114
157
|
// ==================== Admin: Application ====================
|
|
158
|
+
/**
|
|
159
|
+
* [Admin] 获取应用列表(包含 disabled)
|
|
160
|
+
* GET /admin/apps
|
|
161
|
+
*/
|
|
162
|
+
async adminListApps(query, options) {
|
|
163
|
+
return this.request("/admin/apps", {
|
|
164
|
+
...options,
|
|
165
|
+
method: "GET",
|
|
166
|
+
params: query,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
115
169
|
/**
|
|
116
170
|
* [Admin] 获取应用详情(包含 disabled)
|
|
117
|
-
* GET /admin/apps/:
|
|
171
|
+
* GET /admin/apps/:id
|
|
118
172
|
*/
|
|
119
|
-
async adminGetApp(
|
|
120
|
-
return this.request(`/admin/apps/${
|
|
173
|
+
async adminGetApp(id, options) {
|
|
174
|
+
return this.request(`/admin/apps/${id}`, {
|
|
121
175
|
...options,
|
|
122
176
|
method: "GET",
|
|
123
177
|
});
|
|
124
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* [Admin] 创建应用
|
|
181
|
+
* POST /admin/apps
|
|
182
|
+
*/
|
|
183
|
+
async adminCreateApp(request, options) {
|
|
184
|
+
return this.request("/admin/apps", {
|
|
185
|
+
...options,
|
|
186
|
+
method: "POST",
|
|
187
|
+
body: request,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* [Admin] 更新应用
|
|
192
|
+
* PATCH /admin/apps/:id
|
|
193
|
+
*/
|
|
194
|
+
async adminUpdateApp(id, request, options) {
|
|
195
|
+
return this.request(`/admin/apps/${id}`, {
|
|
196
|
+
...options,
|
|
197
|
+
method: "PATCH",
|
|
198
|
+
body: request,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* [Admin] 删除应用
|
|
203
|
+
* DELETE /admin/apps/:id
|
|
204
|
+
*/
|
|
205
|
+
async adminDeleteApp(id, options) {
|
|
206
|
+
return this.request(`/admin/apps/${id}`, {
|
|
207
|
+
...options,
|
|
208
|
+
method: "DELETE",
|
|
209
|
+
});
|
|
210
|
+
}
|
|
125
211
|
/**
|
|
126
212
|
* [Admin] 启用应用
|
|
127
|
-
* POST /admin/apps/:
|
|
213
|
+
* POST /admin/apps/:id/enable
|
|
128
214
|
*/
|
|
129
|
-
async adminEnableApp(
|
|
130
|
-
return this.request(`/admin/apps/${
|
|
215
|
+
async adminEnableApp(id, options) {
|
|
216
|
+
return this.request(`/admin/apps/${id}/enable`, {
|
|
131
217
|
...options,
|
|
132
218
|
method: "POST",
|
|
133
219
|
});
|
|
134
220
|
}
|
|
135
221
|
/**
|
|
136
222
|
* [Admin] 禁用应用
|
|
137
|
-
* POST /admin/apps/:
|
|
223
|
+
* POST /admin/apps/:id/disable
|
|
138
224
|
*/
|
|
139
|
-
async adminDisableApp(
|
|
140
|
-
return this.request(`/admin/apps/${
|
|
225
|
+
async adminDisableApp(id, options) {
|
|
226
|
+
return this.request(`/admin/apps/${id}/disable`, {
|
|
141
227
|
...options,
|
|
142
228
|
method: "POST",
|
|
143
229
|
});
|
package/lib/types/org.d.ts
CHANGED
|
@@ -36,6 +36,34 @@ export interface Project {
|
|
|
36
36
|
createdAt?: string;
|
|
37
37
|
updatedAt: string;
|
|
38
38
|
}
|
|
39
|
+
export interface CreateProjectRequest {
|
|
40
|
+
configId: string;
|
|
41
|
+
name: string;
|
|
42
|
+
description?: string | null;
|
|
43
|
+
homepage?: string | null;
|
|
44
|
+
wechatOfficialAccountId?: string | null;
|
|
45
|
+
wechatMiniProgramId?: string | null;
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface UpdateProjectRequest {
|
|
49
|
+
name?: string;
|
|
50
|
+
description?: string | null;
|
|
51
|
+
homepage?: string | null;
|
|
52
|
+
wechatOfficialAccountId?: string | null;
|
|
53
|
+
wechatMiniProgramId?: string | null;
|
|
54
|
+
}
|
|
55
|
+
export interface ProjectListQuery {
|
|
56
|
+
status?: 'all' | 'active' | 'inactive';
|
|
57
|
+
keyword?: string;
|
|
58
|
+
limit?: number;
|
|
59
|
+
offset?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface ProjectListResponse {
|
|
62
|
+
items: Project[];
|
|
63
|
+
total: number;
|
|
64
|
+
limit: number;
|
|
65
|
+
offset: number;
|
|
66
|
+
}
|
|
39
67
|
export type ApplicationType = 'web' | 'mobile_web' | 'mobile_app' | 'wechat_miniprogram' | 'wechat_minigame' | 'wechat_official_account' | 'unknown';
|
|
40
68
|
export interface Application {
|
|
41
69
|
id?: string;
|
|
@@ -48,6 +76,32 @@ export interface Application {
|
|
|
48
76
|
createdAt?: string;
|
|
49
77
|
updatedAt: string;
|
|
50
78
|
}
|
|
79
|
+
export interface CreateApplicationRequest {
|
|
80
|
+
configId: string;
|
|
81
|
+
projectId: string;
|
|
82
|
+
name: string;
|
|
83
|
+
description?: string | null;
|
|
84
|
+
type?: ApplicationType;
|
|
85
|
+
enabled?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface UpdateApplicationRequest {
|
|
88
|
+
name?: string;
|
|
89
|
+
description?: string | null;
|
|
90
|
+
type?: ApplicationType;
|
|
91
|
+
}
|
|
92
|
+
export interface ApplicationListQuery {
|
|
93
|
+
status?: 'all' | 'active' | 'inactive';
|
|
94
|
+
keyword?: string;
|
|
95
|
+
projectId?: string;
|
|
96
|
+
limit?: number;
|
|
97
|
+
offset?: number;
|
|
98
|
+
}
|
|
99
|
+
export interface ApplicationListResponse {
|
|
100
|
+
items: Application[];
|
|
101
|
+
total: number;
|
|
102
|
+
limit: number;
|
|
103
|
+
offset: number;
|
|
104
|
+
}
|
|
51
105
|
export interface ProjectAppsResponse {
|
|
52
106
|
projectId?: string;
|
|
53
107
|
projectConfigId: string;
|