///
import { Db } from '@cloudbase/database';
import { IWxOpenApiEnterpriseReqOpts } from './wx';
import { ICloudBaseConfig, ICustomReqOpts, ICustomErrRes, IDeleteFileRes, IGetFileUrlRes, IDownloadFileRes, IUploadFileRes, IContext } from './type';
import { Log } from './log';
export declare class CloudBase {
static scfContext: IContext;
static parseContext(context: IContext): IContext;
/**
* 获取当前函数内的所有环境变量(作为获取变量的统一方法,取值来源process.env 和 context)
*/
static getCloudbaseContext(context?: IContext): any;
config: ICloudBaseConfig;
private clsLogger;
private extensionMap;
constructor(config?: ICloudBaseConfig);
init(config?: ICloudBaseConfig): void;
registerExtension(ext: any): void;
invokeExtension(name: any, opts: any): Promise;
database(dbConfig?: any): Db;
/**
* 调用云函数
*
* @param param0
* @param opts
*/
callFunction({ name, data }: {
name: any;
data: any;
}, opts?: ICustomReqOpts): Promise;
auth(): any;
/**
* openapi调用
*
* @param param0
* @param opts
*/
callWxOpenApi({ apiName, requestData }: {
apiName: any;
requestData: any;
}, opts?: ICustomReqOpts): Promise;
/**
* wxpayapi调用
*
* @param param0
* @param opts
*/
callWxPayApi({ apiName, requestData }: {
apiName: any;
requestData: any;
}, opts?: ICustomReqOpts): Promise;
/**
* 微信云调用
*
* @param param0
* @param opts
*/
callCompatibleWxOpenApi({ apiName, requestData }: {
apiName: any;
requestData: any;
}, opts?: ICustomReqOpts): Promise;
/**
* 微信云调用(企业版)
* @param param0
* @param opts
*/
callWxOpenApiEnterprise({ apiName, requestData }: {
apiName: any;
requestData: any;
}, opts?: IWxOpenApiEnterpriseReqOpts): Promise;
/**
* 云调用快捷调用
*/
get openapi(): {
auth: {
getAccessToken: (params: {
force?: boolean;
}) => Promise<{
accessToken: string;
expiresIn: number;
expiresTime: number;
} & import("./openapi/util").CommonError>;
getPaidUnionId: (params: {
openid: string;
transactionId?: string;
mchId?: string;
outTradeNo?: string;
}) => Promise<{
unionid?: string;
} & import("./openapi/util").CommonError>;
};
decrypt: (params: {
openId: string;
iv: string;
encryptedData: string;
}) => Promise;
analysis: {
getDailyRetain: (params: {
beginDate: string;
endDate: string;
}) => Promise<{
refDate?: string;
visitUvNew?: {
key?: number;
value?: number;
};
visitUv?: {
key?: number;
value?: number;
};
} & import("./openapi/util").CommonError>;
getMonthlyRetain: (params: {
beginDate: string;
endDate: string;
}) => Promise<{
refDate?: string;
visitUvNew?: {
key?: number;
value?: number;
};
visitUv?: {
key?: number;
value?: number;
};
} & import("./openapi/util").CommonError>;
getWeeklyRetain: (params: {
beginDate: string;
endDate: string;
}) => Promise<{
refDate?: string;
visitUvNew?: {
key?: number;
value?: number;
};
visitUv?: {
key?: number;
value?: number;
};
} & import("./openapi/util").CommonError>;
getDailySummary: (params: {
beginDate: string;
endDate: string;
}) => Promise<{
list?: {
refDate?: string;
visitTotal?: number;
sharePv?: number;
shareUv?: number;
}[];
} & import("./openapi/util").CommonError>;
getDailyVisitTrend: (params: {
beginDate: string;
endDate: string;
}) => Promise<{
list?: {
refDate?: string;
sessionCnt?: number;
visitPv?: number;
visitUv?: number;
visitUvNew?: number;
stayTimeUv?: number;
stayTimeSession?: number;
visitDepth?: number;
}[];
} & import("./openapi/util").CommonError>;
getMonthlyVisitTrend: (params: {
beginDate: string;
endDate: string;
}) => Promise<{
list?: {
refDate?: string;
sessionCnt?: number;
visitPv?: number;
visitUv?: number;
visitUvNew?: number;
stayTimeUv?: number;
stayTimeSession?: number;
visitDepth?: number;
}[];
} & import("./openapi/util").CommonError>;
getWeeklyVisitTrend: (params: {
beginDate: string;
endDate: string;
}) => Promise<{
list?: {
refDate?: string;
sessionCnt?: number;
visitPv?: number;
visitUv?: number;
visitUvNew?: number;
stayTimeUv?: number;
/**
* 调用云函数
*
* @param param0
* @param opts
*/
stayTimeSession?: number;
visitDepth?: number;
}[];
} & import("./openapi/util").CommonError>; /**
* openapi调用
*
* @param param0
* @param opts
*/
getUserPortrait: (params: {
beginDate: string;
endDate: string;
}) => Promise<{
refDate?: string;
visitUvNew?: {
index?: number;
province?: {
id?: number;
name?: string;
accessSourceVisitUv?: number;
};
city?: {
id?: number;
name?: string;
accessSourceVisitUv?: number;
};
genders?: {
id?: number;
name?: string;
accessSourceVisitUv?: number;
};
platforms?: {
id?: number;
name?: string;
accessSourceVisitUv?: number;
};
devices?: {
id?: number;
name?: string;
accessSourceVisitUv?: number;
};
ages?: {
id?: number;
name?: string;
accessSourceVisitUv?: number;
};
};
visitUv?: {
index?: number;
province?: object;
city?: object;
genders?: object;
platforms?: object;
devices?: object;
ages?: object;
};
} & import("./openapi/util").CommonError>;
getVisitDistribution: (params: {
beginDate: string;
endDate: string;
}) => Promise<{
refDate?: string;
list?: {
index?: "access_source_session_cnt" | "access_staytime_info" | "access_depth_info";
itemList?: {
key?: number;
value?: number;
accessSourceVisitUv?: number;
}[];
}[];
} & import("./openapi/util").CommonError>;
getVisitPage: (params: {
beginDate: string;
endDate: string;
}) => Promise<{
pagePath?: string;
pageVisitPv?: number;
pageVisitUv?: number;
pageStaytimePv?: number;
entrypagePv?: number;
exitpagePv?: number;
pageSharePv?: number;
pageShareUv?: number;
} & import("./openapi/util").CommonError>;
};
customerServiceMessage: {
getTempMedia: (params: {
mediaId: string;
}) => Promise<{
contentType?: string;
buffer?: Buffer;
} & import("./openapi/util").CommonError>;
send: (params: {
touser: string;
msgtype: "link" | "image" | "text" | "miniprogrampage";
text: {
content: string;
};
image: {
mediaId: string;
};
link: {
title: string;
description: string;
url: string;
thumbUrl: string;
};
miniprogrampage: {
title: string;
pagepath: string;
thumbMediaId: string;
};
}) => Promise;
setTyping: (params: {
touser: string;
command: "Typing" | "CancelTyping";
}) => Promise;
uploadTempMedia: (params: {
type: "image";
media: {
contentType: string;
value: Buffer;
};
}) => Promise<{
type?: "image";
mediaId?: string;
createdAt?: number;
} & import("./openapi/util").CommonError>;
};
templateMessage: {
addTemplate: (params: {
id: string;
keywordIdList: number[];
}) => Promise<{
templateId?: string;
} & import("./openapi/util").CommonError>;
deleteTemplate: (params: {
templateId: string;
}) => Promise;
getTemplateLibraryById: (params: {
id: string;
}) => Promise<{
id?: string;
title?: string;
keywordList?: {
keywordId?: string;
name?: string;
example?: string;
}[];
} & import("./openapi/util").CommonError>;
getTemplateLibraryList: (params: {
offset: number;
count: number;
}) => Promise<{
id?: string;
title?: string;
totalCount?: number;
} & import("./openapi/util").CommonError>;
getTemplateList: (params: {
offset: number;
count: number;
}) => Promise<{
list?: {
templateId?: string;
title?: string;
content?: string;
example?: string;
}[];
} & import("./openapi/util").CommonError>;
send: (params: {
touser: string;
templateId: string;
page?: string;
formId: string;
data?: object;
emphasisKeyword?: string;
}) => Promise;
};
uniformMessage: {
send: (params: {
touser: string;
weappTemplateMsg?: {
templateId: string;
page: string;
formId: string;
data: string;
emphasisKeyword: string;
};
mpTemplateMsg: {
appid: string;
templateId: string;
url: string;
miniprogram: string;
data: string;
};
}) => Promise;
};
updatableMessage: {
createActivityId: (params: Buffer) => Promise<{
activityId?: string;
expirationTime?: number;
} & import("./openapi/util").CommonError>;
setUpdatableMsg: (params: {
activityId: string;
targetState: import("v8").DoesZapCodeSpaceFlag;
templateInfo: {
parameterList: {
name: "path" | "member_count" | "room_limit" | "version_type";
value: string;
}[];
};
}) => Promise;
};
pluginManager: {
applyPlugin: (params: {
action: string;
pluginAppid: string;
reason?: string;
}) => Promise;
getPluginDevApplyList: (params: {
action: string;
page: number;
num: number;
}) => Promise<{
applyList?: {
appid?: string;
status?: 2 | 1 | 4 | 3;
nickname?: string;
headimgurl?: string;
categories?: object[];
createTime?: string;
applyUrl?: string;
reason?: string;
}[];
} & import("./openapi/util").CommonError>;
getPluginList: (params: {
action: string;
}) => Promise<{
pluginList?: {
appid?: string;
status?: 2 | 1 | 4 | 3;
nickname?: string;
headimgurl?: string;
}[];
} & import("./openapi/util").CommonError>;
setDevPluginApplyStatus: (params: {
action: "dev_agree" | "dev_refuse" | "dev_delete";
appid?: string;
reason?: string;
}) => Promise;
unbindPlugin: (params: {
action: string;
pluginAppid: string;
}) => Promise;
};
nearbyPoi: {
add: (params: {
isCommNearby: string;
picList: string;
serviceInfos: string;
kfInfo: string;
storeName: string;
hour: string;
address: string;
poiId: string;
companyName: string;
contractPhone: string;
credential: string;
qualificationList: string;
mapPoiId: string;
}) => Promise<{
data?: {
auditId?: string;
poiId?: string;
relatedCredential?: string;
};
} & import("./openapi/util").CommonError>;
delete: (params: {
poiId: string;
}) => Promise;
getList: (params: {
page: number;
pageRows: number;
}) => Promise<{
data?: {
poiList?: {
poiId?: string;
qualificationAddress?: string;
qualificationNum?: string;
auditStatus?: 5 | 4 | 3;
displayStatus?: import("v8").DoesZapCodeSpaceFlag;
refuseReason?: string;
}[];
};
} & import("./openapi/util").CommonError>;
setShowStatus: (params: {
poiId: string;
status: import("v8").DoesZapCodeSpaceFlag;
}) => Promise;
};
wxacode: {
createQRCode: (params: {
path: string;
width?: number;
}) => Promise<{
contentType?: string;
buffer?: Buffer;
} & import("./openapi/util").CommonError>;
get: (params: {
path: string;
width?: number;
autoColor?: boolean;
lineColor?: object;
isHyaline?: boolean;
}) => Promise<{
contentType?: string;
buffer?: Buffer;
} & import("./openapi/util").CommonError>;
getUnlimited: (params: {
scene: string;
page?: string;
width?: number;
autoColor?: boolean;
lineColor?: object;
isHyaline?: boolean;
}) => Promise<{
contentType?: string;
buffer?: Buffer;
} & import("./openapi/util").CommonError>;
};
security: {
imgSecCheck: (params: {
media: {
contentType: string;
value: Buffer;
};
}) => Promise;
msgSecCheck: (params: {
content: string;
}) => Promise;
};
logistics: {
batchGetOrder: (params: {
orderList: {
orderId: string;
deliveryId: string;
waybillId?: string;
}[];
}) => Promise<{
orderList?: {
errcode?: number;
errmsg?: string;
orderId?: string;
deliveryId?: string;
waybillId?: string;
printHtml?: string;
waybillData?: {
key?: string;
value?: string;
}[];
}[];
orderStatus?: number;
} & import("./openapi/util").CommonError>;
addOrder: (params: {
addSource: number;
wxAppid?: string;
orderId: string;
openid?: string;
deliveryId: string;
bizId: string;
customRemark?: string;
tagid?: number;
sender: {
name: string;
tel?: string;
mobile?: string;
company?: string;
postCode?: string;
country?: string;
province: string;
city: string;
area: string;
address: string;
};
receiver: {
name: string;
tel?: string;
mobile?: string;
company?: string;
postCode?: string;
country?: string;
province: string;
city: string;
area: string;
address: string;
};
cargo: {
count: number;
weight: number;
spaceX: number;
spaceY: number;
spaceZ: number;
detailList: {
name: string;
count: number;
}[];
};
shop: {
wxaPath: string;
imgUrl: string;
goodsName: string;
goodsCount: number;
};
insured: {
useInsured: number;
insuredValue: number;
};
service: {
serviceType: number;
serviceName: string;
};
expectTime?: number;
}) => Promise<{
orderId?: string;
waybillId?: string;
waybillData?: {
key?: string;
value?: string;
}[];
deliveryResultcode?: number;
deliveryResultmsg?: string;
} & import("./openapi/util").CommonError>;
bindAccount: (params: {
type: string;
bizId: string;
deliveryId: string;
password?: string;
remarkContent?: string;
}) => Promise;
cancelOrder: (params: {
orderId: string;
openid?: string;
deliveryId: string;
waybillId: string;
}) => Promise<{
deliveryResultcode?: number;
deliveryResultmsg?: string;
} & import("./openapi/util").CommonError>;
getAllAccount: (params: Buffer) => Promise<{
count?: number;
list?: {
bizId?: string;
deliveryId?: string;
createTime?: number;
updateTime?: number;
statusCode?: 0 | 2 | 1 | 3;
alias?: string;
remarkWrongMsg?: string;
remarkContent?: string;
quotaNum?: number;
quotaUpdateTime?: number;
serviceType?: {
serviceType?: number;
serviceName?: string;
}[];
}[];
} & import("./openapi/util").CommonError>;
getAllDelivery: (params: Buffer) => Promise<{
count?: number;
data?: {
deliveryId?: string;
deliveryName?: string;
canUseCash?: number;
canGetQuota?: number;
cashBizId?: string;
serviceType?: {
serviceType?: number;
serviceName?: string;
}[];
}[];
} & import("./openapi/util").CommonError>;
getOrder: (params: {
orderId: string;
openid?: string;
deliveryId: string;
waybillId?: string;
}) => Promise<{
printHtml?: string;
waybillData?: {
key?: string;
value?: string;
}[];
deliveryId?: string;
orderId?: string;
waybillId?: string;
orderStatus?: number;
} & import("./openapi/util").CommonError>;
getPath: (params: {
orderId: string;
openid?: string;
deliveryId: string;
waybillId: string;
}) => Promise<{
openid?: string;
deliveryId?: string;
waybillId?: string;
pathItemNum?: number;
pathItemList?: {
actionTime?: number;
actionType?: 100001 | 100002 | 100003 | 200001 | 300002 | 300003 | 300004 | 400001 | 400002;
actionMsg?: string;
}[];
} & import("./openapi/util").CommonError>;
getPrinter: (params: Buffer) => Promise;
getQuota: (params: {
deliveryId: string;
bizId: string;
}) => Promise<{
quotaNum?: number;
} & import("./openapi/util").CommonError>;
updatePrinter: (params: {
openid: string;
updateType: "bind" | "unbind";
tagidList?: string;
}) => Promise;
getContact: (params: {
token: string;
waybillId: string;
}) => Promise<{
waybillId?: string;
sender?: {
address?: string;
name?: string;
tel?: string;
mobile?: string;
}[];
receiver?: {
address?: string;
name?: string;
tel?: string;
mobile?: string;
}[];
} & import("./openapi/util").CommonError>;
previewTemplate: (params: {
waybillId: string;
waybillTemplate: string;
waybillData: string;
custom: object;
}) => Promise<{
waybillId?: string;
renderedWaybillTemplate?: string;
} & import("./openapi/util").CommonError>;
updateBusiness: (params: {
shopAppId: string;
bizId: string;
resultCode: number;
resultMsg?: string;
}) => Promise;
updatePath: (params: {
token: string;
waybillId: string;
actionTime: number;
actionType: 100001 | 100002 | 100003 | 200001 | 300002 | 300003 | 300004 | 400001 | 400002;
actionMsg: string;
}) => Promise;
};
img: {
aiCrop: (params: {
imgUrl: string;
img: {
contentType: string;
value: Buffer;
};
}) => Promise;
scanQRCode: (params: {
imgUrl: string;
img: {
contentType: string;
value: Buffer;
};
}) => Promise;
superresolution: (params: {
imgUrl: string;
img: {
contentType: string;
value: Buffer;
};
}) => Promise;
};
ocr: {
bankcard: (params: {
imgUrl: string;
img: {
contentType: string;
value: Buffer;
};
}) => Promise<{
number?: string;
} & import("./openapi/util").CommonError>;
businessLicense: (params: {
imgUrl: string;
img: {
contentType: string;
value: Buffer;
};
}) => Promise<{
regNum?: string;
serial?: string;
legalRepresentative?: string;
enterpriseName?: string;
typeOfOrganization?: string;
address?: string;
typeOfEnterprise?: string;
businessScope?: string;
registeredCapital?: string;
paidInCapital?: string;
validPeriod?: string;
registeredDate?: string;
certPosition?: string;
imgSize?: string;
} & import("./openapi/util").CommonError>;
driverLicense: (params: {
imgUrl: string;
img: {
contentType: string;
value: Buffer;
};
}) => Promise<{
idNum?: string;
name?: string;
sex?: string;
address?: string;
birthDate?: string;
issueDate?: string;
carClass?: string;
validFrom?: string;
validTo?: string;
officialSeal?: string;
} & import("./openapi/util").CommonError>;
idcard: (params: {
imgUrl: string;
img: {
contentType: string;
value: Buffer;
};
}) => Promise<{
type?: string;
validDate?: string;
} & import("./openapi/util").CommonError>;
printedText: (params: {
imgUrl: string;
img: {
contentType: string;
value: Buffer;
};
}) => Promise<{
items?: string;
imgSize?: string;
} & import("./openapi/util").CommonError>;
vehicleLicense: (params: {
type: string;
imgUrl: string;
img: {
contentType: string;
value: Buffer;
};
}) => Promise<{
vehicleType?: string;
owner?: string;
addr?: string;
useCharacter?: string;
model?: string;
vin?: string;
engineNum?: string;
registerDate?: string;
issueDate?: string;
plateNumB?: string;
record?: string;
passengersNum?: string;
totalQuality?: string;
totalprepareQualityQuality?: string;
} & import("./openapi/util").CommonError>;
};
search: {
imageSearch: (params: {
img: object[];
}) => Promise<{
items?: {
title?: string;
imgUrl?: string;
price?: string;
path?: string;
}[];
} & import("./openapi/util").CommonError>;
siteSearch: (params: {
keyword: string;
nextPageInfo: string;
}) => Promise<{
items?: {
title?: string;
description?: string;
image?: string;
path?: string;
}[];
hasNextPage?: boolean;
nextPageInfo?: string;
hitCount?: number;
} & import("./openapi/util").CommonError>;
submitPages: (params: {
pages: {
path: string;
query: string;
}[];
}) => Promise;
};
serviceMarket: {
invokeService: (params: {
service: string;
api: string;
data: string;
clientMsgId: string;
}) => Promise<{
templateId?: string;
} & import("./openapi/util").CommonError>;
};
soter: {
verifySignature: (params: {
openid: string;
jsonString: string;
jsonSignature: string;
}) => Promise<{
isOk?: boolean;
} & import("./openapi/util").CommonError>;
};
subscribeMessage: {
addTemplate: (params: {
tid: string;
kidList: number[];
sceneDesc?: string;
}) => Promise<{
priTmplId?: string;
} & import("./openapi/util").CommonError>;
deleteTemplate: (params: {
priTmplId: string;
}) => Promise;
getCategory: (params: Buffer) => Promise<{
data?: {
id?: number;
name?: string;
}[];
} & import("./openapi/util").CommonError>;
getPubTemplateKeyWordsById: (params: {
tid: string;
}) => Promise<{
count?: number;
data?: {
kid?: number;
name?: string;
example?: string;
rule?: string;
}[];
} & import("./openapi/util").CommonError>;
getPubTemplateTitleList: (params: {
ids: string;
start: number;
limit: number;
}) => Promise<{
count?: number;
data?: {
tid?: number;
title?: string;
type?: number;
categoryId?: number;
}[];
} & import("./openapi/util").CommonError>;
getTemplateList: (params: Buffer) => Promise<{
data?: {
priTmplId?: string;
title?: string;
content?: string;
example?: string;
type?: number;
}[];
} & import("./openapi/util").CommonError>;
send: (params: {
touser: string;
templateId: string;
page?: string;
data: object;
miniprogramState?: string;
lang?: string;
}) => Promise;
};
};
/**
* 上传文件
*
* @param param0
* @param opts
*/
uploadFile({ cloudPath, fileContent }: {
cloudPath: any;
fileContent: any;
}, opts?: ICustomReqOpts): Promise;
/**
* 删除文件
*
* @param param0
* @param opts
*/
deleteFile({ fileList }: {
fileList: any;
}, opts?: ICustomReqOpts): Promise;
/**
* 获取临时连接
*
* @param param0
* @param opts
*/
getTempFileURL({ fileList }: {
fileList: any;
}, opts?: ICustomReqOpts): Promise;
/**
* 下载文件
*
* @param params
* @param opts
*/
downloadFile(params: {
fileID: string;
tempFilePath?: string;
}, opts?: ICustomReqOpts): Promise;
/**
* 获取上传元数据
*
* @param param0
* @param opts
*/
getUploadMetadata({ cloudPath }: {
cloudPath: any;
}, opts?: ICustomReqOpts): Promise;
/**
* 获取logger
*
*/
logger(): Log;
}