@etsoo/smarterp-core
Version:
TypeScript APIs for SmartERP Core
223 lines (222 loc) • 5.44 kB
TypeScript
import { IApi } from "@etsoo/restclient";
import { MemberApi } from "./MemberApi";
import { OrgApi } from "./OrgApi";
import { AppApi } from "./AppApi";
import { PublicApi } from "./PublicApi";
import { UserApi } from "./UserApi";
import { AuthApi, IApp, IdentityType, IdentityTypeFlags, UserIdentifierType } from "@etsoo/appscript";
import { AuthCodeApi } from "./AuthCodeApi";
import { ListType } from "@etsoo/shared";
import { CoreApiService } from "./dto/org/CoreApiService";
type AppData = {
id: number;
appId?: number;
name: string;
localName?: string;
};
/**
* Core application interface
* 核心应用程序接口
*/
export interface ICoreApp {
/**
* Application API
*/
readonly appApi: AppApi;
/**
* Authentication API
*/
readonly authApi: AuthApi;
/**
* Auth code API
*/
readonly authCodeApi: AuthCodeApi;
/**
* Member API
*/
readonly memberApi: MemberApi;
/**
* Organization API
*/
readonly orgApi: OrgApi;
/**
* Public API
*/
readonly publicApi: PublicApi;
/**
* User API
*/
readonly userApi: UserApi;
/**
* Get API service label
* 获取API服务标签
* @param service API service
* @returns Result
*/
getApiService(service?: CoreApiService): string;
/**
* Get API services
* 获取API服务列表
* @returns List of API services
*/
getApiServices(): ListType[];
/**
* Get app name
* 获取应用名称
* @param data App data
* @returns Name
*/
getAppName(data: AppData): string;
/**
* Get user identifier type label
* 获取用户标识类型标签
* @param type Type
* @returns Label
*/
getIdentifierTypeLabel(type: UserIdentifierType): string;
/**
* Get identity label
* 获取身份标签
* @param identity Identity value
* @param joinChar Join character
* @returns Label(s)
*/
getIdentityLabel(identity: IdentityType | null | undefined, joinChar?: string): string;
/**
* Get identity label
* 获取身份标签
* @param identity Identity value
* @param joinChar Join character
* @returns Label(s)
*/
getIdentityFlagsLabel(identity: IdentityTypeFlags | null | undefined, joinChar?: string): string;
/**
* Get identities
* 获取身份列表
* @param identity Identity value combined
* @returns List
*/
getIdentities(identity?: number): ListType[];
/**
* Get identity flags
* 获取身份标志组合
* @param identity Identity value combined
* @returns List
*/
getIdentityFlags(identity?: number): ListType[];
}
/**
* Core application
* 核心应用程序
*/
export declare class CoreApp implements ICoreApp {
readonly app: IApp;
readonly api: IApi;
private _appApi?;
/**
* Application API
* 应用程序接口
*/
get appApi(): AppApi;
private _authApi?;
/**
* Authentication API
* 认证接口
*/
get authApi(): AuthApi;
private _authCodeApi?;
/**
* Authentication API
* 认证接口
*/
get authCodeApi(): AuthCodeApi;
private _memberApi?;
/**
* Member API
* 会员接口
*/
get memberApi(): MemberApi;
private _orgApi?;
/**
* Organization API
* 机构接口
*/
get orgApi(): OrgApi;
private _publicApi?;
/**
* Public API
* 公共接口
*/
get publicApi(): PublicApi;
private _userApi?;
/**
* User API
* 用户接口
*/
get userApi(): UserApi;
/**
* Constructor
* 构造函数
* @param app Base application
* @param api API
*/
constructor(app: IApp, api: IApi);
/**
* Get API service label
* 获取API服务标签
* @param service API service
* @returns Result
*/
getApiService(service?: CoreApiService): string;
/**
* Get API services
* 获取API服务列表
* @returns List of API services
*/
getApiServices(): ListType[];
/**
* Get app name
* 获取应用名称
* @param data App data
* @returns Name
*/
getAppName(data: AppData): string;
/**
* Get user identifier type label
* 获取用户标识类型标签
* @param type Type
* @returns Label
*/
getIdentifierTypeLabel(type: UserIdentifierType): string;
/**
* Get identity label
* 获取身份标签
* @param identity Identity value
* @param joinChar Join character
* @returns Label(s)
*/
getIdentityLabel(identity: IdentityType | null | undefined, joinChar?: string): string;
/**
* Get identity flags label
* 获取身份组合标签
* @param identity Identity value
* @param joinChar Join character
* @returns Label(s)
*/
getIdentityFlagsLabel(identity: IdentityTypeFlags | null | undefined, joinChar?: string): string;
/**
* Get identities
* 获取身份列表
* @param identity Identity value combined
* @returns List
*/
getIdentities(identity?: number): ListType[];
/**
* Get identity flags
* 获取身份标志组合
* @param identity Identity value combined
* @returns List
*/
getIdentityFlags(identity?: number): ListType[];
}
export {};