Files
query-awesome/query/query-app/query-app.ts

60 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { appDefine, userAppDefine } from './defines/index.ts';
import { BaseQuery, DataOpts, Query } from '@kevisual/query/query';
export { appDefine, userAppDefine };
export class QueryApp extends BaseQuery {
appDefine = appDefine;
userAppDefine = userAppDefine;
constructor(opts?: { query: Query }) {
super(opts!);
this.appDefine.query = this.query;
this.userAppDefine.query = this.query;
}
getList(data: any, opts?: DataOpts) {
return this.appDefine.queryChain('listApps').post(data, opts);
}
getPublicApp(data: any, opts?: DataOpts) {
return this.query.post({
path: 'app',
key: 'getApp',
data: data,
}, opts);
}
getApp(data: {
key?: string;
version?: string;
/**
* 当app不存在会创建一个新的
* 之后上传文件就好了,会执行检测任务
*/
create?: boolean;
}, opts?: DataOpts) {
return this.query.post({
path: 'app',
key: 'get',
data: data,
}, opts);
}
/**
* 发布应用
* @param data
* @param opts
* @returns
*/
publichApp(data: {
id?: string;
username?: string,
detect?: boolean,
appKey?: string;
version?: string;
}, opts?: DataOpts) {
return this.query.post({
path: 'app',
key: 'publish',
data: { detect: true, ...data },
}, opts);
}
}