Namespace: BaaS

BaaS

知晓云 JS SDK 命名空间
Source:

Classes

BaseQuery
BaseRecord
ContentGroup
CurrentUser
File
FileCategory
GeoPoint
GeoPolygon
HError
Order
Query
TableObject
TableRecord
User
UserRecord

Namespaces

_config
auth
storage
storageAsync

Methods

(static) censorText(text) → {Promise.<any>}

检测违规文本
Parameters:
Name Type Description
text string 带检测的文本内容
Source:
Returns:
Type
Promise.<any>

(static) checkVersion(options)

SDK 版本检查
Parameters:
Name Type Description
options BaaS.CheckVersionOptions
Source:

(static) clearSession()

清除会话(退出登录)
Source:

(static) getAlipayQRCode(options) → {Promise.<BaaS.AlipayQRCodeResult>}

获取二维码
Parameters:
Name Type Description
options BaaS.AlipayQRCodeParams 参数
Source:
Returns:
Type
Promise.<BaaS.AlipayQRCodeResult>

(static) getAsyncJobResult(operationID) → {Promise.<BaaS.Response.<any>>}

获取异步操作执行结果
Parameters:
Name Type Description
operationID number 异步操作 ID
Source:
Returns:
Type
Promise.<BaaS.Response.<any>>

(static) getAuthToken() → {string}

获取 token
Source:
Returns:
Type
string

(static) getServerDate() → {Promise.<BaaS.Response.<BaaS.ServerDate>>}

获取服务器时间
Source:
Returns:
Type
Promise.<BaaS.Response.<BaaS.ServerDate>>

(static) init(clientID, optionsopt)

SDK 初始化
Parameters:
Name Type Attributes Description
clientID string 知晓云应用的 client id
options BaaS.InitOptions <optional>
其他选项
Source:

(static) invoke(functionName, paramsopt, syncopt) → {Promise.<any>}

调用云函数
Parameters:
Name Type Attributes Description
functionName string 云函数名称
params object <optional>
参数
sync boolean <optional>
是否同步运行
Source:
Returns:
Type
Promise.<any>

(static) pay(params) → {Promise.<any>}

支付宝支付
Parameters:
Name Type Description
params BaaS.PaymentParams 参数
Source:
Returns:
Type
Promise.<any>

(static) reportTemplateMsgAnalytics(options)

上报模板消息卡片点击事件
Parameters:
Name Type Description
options any onShow 方法中的 options 参数
Source:

(static) reportTicket(formID) → {Promise.<any>}

上报模板消息所需 formID
Parameters:
Name Type Description
formID string formID
Source:
Returns:
Type
Promise.<any>

(static) request(params) → {Promise.<BaaS.Response.<any>>}

网络请求
Parameters:
Name Type Description
params BaaS.AlipayRequestParams 参数
Source:
Returns:
Type
Promise.<BaaS.Response.<any>>

(static) uploadFile(fileParams, metaData) → {Promise.<any>}

上传文件。
Parameters:
Name Type Description
fileParams FileParams 文件参数
metaData FileMeta 文件元信息
Source:
Returns:
Type
Promise.<any>

Type Definitions

AlipayQRCodeParams

获取二维码参数
Properties:
Name Type Description
urlParam string 页面地址,最多 128 个字符
queryParam string 启动参数,最多 128 个字符
describe string 码描述,最少 2 个字符,最多 20 个字符
Source:

AlipayQRCodeResult

获取二维码返回结果
Properties:
Name Type Description
image_url string 二维码地址,二维码的下载链接
Source:

AlipayRequestParams

请求参数
Properties:
Name Type Attributes Description
url string 请求的 URL
method string <optional>
HTTP 请求方法,默认为 'GET'
data object <optional>
请求的参数
header object <optional>
请求的 header
headers object <optional>
请求的 header
dataType string <optional>
返回的数据格式
Source:

AuthData

强制登录的授权参数
Type:
  • Object
Properties:
Name Type Description
detail BaaS.UserInfoDetail 用户信息
Source:

AuthWithEmailOptions

登录/注册参数(邮箱 + 密码)
Properties:
Name Type Description
email string 邮箱
password string 密码
Source:

AuthWithPhoneOptions

登录/注册参数(手机号码 + 密码)
Properties:
Name Type Description
phone string 手机号码
password string 密码
Source:

AuthWithUsernameOptions

登录/注册参数(用户名 + 密码)
Properties:
Name Type Description
username string 用户名
password string 密码
Source:

BatchUpdateParams

批量更新参数
Properties:
Name Type Attributes Description
enableTrigger boolean <optional>
是否触发触发器
withCount boolean <optional>
是否返回 total_count
Source:

CensorAsyncResult

Properties:
Name Type Attributes Description
id string 文件 ID
error_code string <optional>
错误码,=0 时不返回此字段
error_message string <optional>
错误信息,error_code=0 时不返回此字段
status_code number 默认为:0,4294966288(-1008)为链接无法下载
risky boolean 是否为违规内容,true 为风险,false 为未检测到风险,null 为微信尚未推送检查结果
Source:

CheckVersionOptions

检测版本选项
Properties:
Name Type Description
platform string 需要检测的平台
onSuccess function 接口请求成功时回调
onError function 接口请求失败时的回调
Source:

CreateManyParams

批量创建参数
Properties:
Name Type Attributes Description
enableTrigger boolean <optional>
是否触发触发器
Source:

FileMeta

文件元信息(文件上传)
Properties:
Name Type Attributes Description
categoryID string <optional>
文件分类 ID
categoryName string <optional>
要上传的文件分类名
Source:

FileOperationResult

文件操作返回结果
Type:
  • Object
Properties:
Name Type Description
created_at number 创建时间 (格式为 unix 时间戳)
path string 路径
created_by number 创建者 ID
mime_type string mime_type 类型
media_type string 媒体类型
size number 文件大小
name string 文件名
status string 文件状态
reference string 引用
cdn_path string cdn 中保存的路径
updated_at number Integer 更新时间 (格式为 unix 时间戳)
categories Array.<string> 文件所属类别
_id string 本条记录 ID
Source:

FileParams

文件参数(文件上传)
Properties:
Name Type Attributes Description
filePath string <optional>
本地资源路径(非 Web)
fileObj object <optional>
本地资源路径(Web)
fileType 'image' | 'video' | 'audio' <optional>
本地资源路径(Alipay)
Source:

FindOptions

查询参数
Properties:
Name Type Attributes Description
withCount boolean <optional>
是否返回 total_count
Source:

GeoJson

GeoJson
Properties:
Name Type Description
type string 类型
coordinates Array.<number> 坐标
Source:

GetOrderListParams

获取支付订单参数
Properties:
Name Type Attributes Description
merchandise_record_id string <optional>
商品记录 ID,可用于定位用户购买的物品
merchandise_schema_id string <optional>
商品表 ID,可用于定位用户购买的物品
status 'complete' | 'pending' | 'success' | 'partial' <optional>
订单支付状态
trade_no string <optional>
真正的交易 ID, 业务方在服务方后台对账时可看到此字段
transactionID string <optional>
知晓云平台所记录的流水号
gateway_type string <optional>
支付方法,可选值有:weixin_tenpay(微信支付)、alipay(支付宝支付)等
Source:

handleUserInfoOptions

登录可选参数
Type:
  • Object
Properties:
Name Type Attributes Description
options.detail BaaS.UserInfoDetail 用户信息
createUser boolean <optional>
是否创建用户
syncUserProfile 'overwrite' | 'setnx' | 'false' <optional>
是否同步第一层级用户信息,默认为 'setnx'。值说明: 'overwrite' - 强制更新 'setnx' - 仅当字段从未被赋值时才更新 'false' - 不更新
Source:

InitOptions

SDK 初始化选项
Properties:
Name Type Attributes Description
autoLogin boolean <optional>
是否自动登录
logLevel string <optional>
日志输出等级
host string <optional>
接口域名
ws_host string <optional>
WebSocket 域名
env string <optional>
开发环境 ID
Source:

LinkAlipayParams

关联支付宝账号参数
Properties:
Name Type Attributes Description
forceLogin boolean <optional>
是否强制登录
syncUserProfile 'overwrite' | 'setnx' | 'false' <optional>
是否同步第一层级用户信息,默认为 'setnx'。值说明: 'overwrite' - 强制更新 'setnx' - 仅当字段从未被赋值时才更新 'false' - 不更新
Source:

LinkAuthDataAuthData

Properties:
Name Type Attributes Description
token string oauth 登录后返回的 token
username string <optional>
用户名(Apple 登录时必填)
Source:

LinkAuthDataOptions

Properties:
Name Type Attributes Description
syncUserProfile 'overwrite' | 'setnx' | 'false' <optional>
是否同步第一层级用户信息,默认为 'setnx'。值说明: 'overwrite' - 强制更新 'setnx' - 仅当字段从未被赋值时才更新 'false' - 不更新
provider string 第三方平台
Source:

LinkBytedanceParams

关联字节跳动账号参数
Properties:
Name Type Attributes Description
forceLogin boolean <optional>
是否强制登录
syncUserProfile 'overwrite' | 'setnx' | 'false' <optional>
是否同步第一层级用户信息,默认为 'setnx'。值说明: 'overwrite' - 强制更新 'setnx' - 仅当字段从未被赋值时才更新 'false' - 不更新
Source:

LinkOptions

关联账号可选参数
Type:
  • Object
Properties:
Name Type Attributes Description
syncUserProfile 'overwrite' | 'setnx' | 'false' <optional>
是否同步第一层级用户信息,默认为 'setnx'。值说明: 'overwrite' - 强制更新 'setnx' - 仅当字段从未被赋值时才更新 'false' - 不更新
Source:

LinkThirdPartyParams

Properties:
Name Type Attributes Description
syncUserProfile 'overwrite' | 'setnx' | 'false' <optional>
是否同步第一层级用户信息,默认为 'setnx'。值说明: 'overwrite' - 强制更新 'setnx' - 仅当字段从未被赋值时才更新 'false' - 不更新
debug boolean <optional>
是否开启 debug 模式
mode 'popup-window' | 'popup-iframe' | 'redirect' <optional>
授权窗口打开模式
authModalStyle Object <optional>
popup-iframe 模式下,授权模态框的样式
wechatIframeContentStyle Object <optional>
微信 web 授权,在 popup-iframe 模式下,微信授权页面的样式
windowFeatures string <optional>
popup-window 模式下,授权窗口的特性,详见 https://developer.mozilla.org/zh-CN/docs/Web/API/Window/open
Source:

LinkWechatOptions

关联微信账号可选参数
Type:
  • Object
Properties:
Name Type Attributes Description
withUnionID boolean <optional>
是否使用 unionid 进行关联
syncUserProfile 'overwrite' | 'setnx' | 'false' <optional>
是否同步第一层级用户信息,默认为 'setnx'。值说明: 'overwrite' - 强制更新 'setnx' - 仅当字段从未被赋值时才更新 'false' - 不更新
Source:

LoginOptions

登录可选参数
Type:
  • Object
Properties:
Name Type Attributes Description
createUser boolean <optional>
是否创建用户
syncUserProfile 'overwrite' | 'setnx' | 'false' <optional>
是否同步第一层级用户信息,默认为 'setnx'。值说明: 'overwrite' - 强制更新 'setnx' - 仅当字段从未被赋值时才更新 'false' - 不更新
Source:

LoginWithAlipayParams

支付宝登录参数
Properties:
Name Type Attributes Description
forceLogin boolean <optional>
是否强制登录
scopes Array.<string> <optional>
需要用户授权的 scope 列表
createUser boolean <optional>
是否创建用户
syncUserProfile 'overwrite' | 'setnx' | 'false' <optional>
是否同步第一层级用户信息,默认为 'setnx'。值说明: 'overwrite' - 强制更新 'setnx' - 仅当字段从未被赋值时才更新 'false' - 不更新
Source:

Module(BaaS)

模块
Parameters:
Name Type Description
BaaS any BaaS 对象
Source:

PasswordResetParam

Properties:
Name Type Description
email string email 地址
Source:

PaymentParams

支付参数
Properties:
Name Type Attributes Description
merchandiseDescription string 微信支付凭证-商品详情的内容
totalCost number 支付总额,单位:元
merchandiseSchemaID string <optional>
商品数据表 ID,可用于定位用户购买的物品
merchandiseRecordID string <optional>
商品数据行 ID,可用于定位用户购买的物品
merchandiseSnapshot object <optional>
根据业务需求自定义的数据
Source:

RequestParams

请求参数
Properties:
Name Type Attributes Description
url string 请求的 URL
method string <optional>
HTTP 请求方法,默认为 'GET'
data object <optional>
请求的参数
header object <optional>
请求的 header
dataType string <optional>
返回的数据格式
Source:

Response

网络请求返回值
Type:
  • object.<T>
Properties:
Name Type Description
header object HTTP Response Header
data T 数据
statusCode number HTTP 状态码
status number HTTP 状态码
Source:

ServerDate

Properties:
Name Type Description
time string 服务器时间 (ISO 8601)
Source:

SetAccountParmas

设置账号参数
Properties:
Name Type Attributes Description
username string | null <optional>
用户名
email string | null <optional>
邮箱
password string | null <optional>
密码
Source:

SetEmailOptions

Properties:
Name Type Description
sendVerificationEmail boolean 是否发送验证邮件
Source:

UpdatePasswordParams

更新密码
Properties:
Name Type Description
password string 旧密码
newPassword string 新密码
Source:

UserInfoDetail

用户信息
Type:
  • Object
Properties:
Name Type Description
userInfo Object 用户信息对象,不包含 openid 等敏感信息
rawData string 不包括敏感信息的原始数据字符串,用于计算签名
signature string 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息
encryptedData string 包括敏感数据在内的完整用户信息的加密数据
iv string 加密算法的初始向量
Source:

VideoAudioMetaFormat

音视频格式信息
Properties:
Name Type Description
bitrate number 比特率
duration number 时长
format string 容器格式
fullname string 容器格式全称
Source:

VideoAudioMetaParams

音视频的元信息请求参数
Properties:
Name Type Description
source string 文件的 ID
Source:

VideoAudioMetaResult

音视频的元信息请求结果
Properties:
Name Type Description
format BaaS.VideoAudioMetaFormat 音视频格式信息
streams Array.<BaaS.VideoAudioMetaStreams> stream 列表
Source:

VideoAudioMetaStreams

音视频流
Properties:
Name Type Description
index number 表示第几路流
type string 一般情况下, video 或 audio
bitrate number 流码率
codec string 流编码
codec_desc string 流编码说明
duration number 流时长
video_fps number (视频流)视频帧数
video_height number (视频流)视频高度
video_width number (视频流)视频宽度
audio_channels number (音频流)音频通道数
audio_samplerate number (音频流)音频采样率
Source:

VideoClipParams

视频剪辑参数
Properties:
Name Type Attributes Description
m3u8s string 视频文件的 id 列表,按提交的顺序进行拼接
save_as string 保存的文件名
category_id string <optional>
文件所属类别 ID
random_file_link boolean <optional>
是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件,默认为 true
include Array.<string> <optional>
包含某段内容的开始结束时间,单位是秒。当 index 为 false 时,为开始结束分片序号
exclude Array.<string> <optional>
不包含某段内容的开始结束时间,单位是秒。当 index 为 false 时,为开始结束分片序号
index boolean <optional>
include 或者 exclude 中的值是否为 ts 分片序号,默认为 false
Source:

VideoConcatParams

视频拼接参数
Properties:
Name Type Attributes Description
m3u8s Array.<string> 视频件的 id 列表,按提交的顺序进行拼接
save_as string 视频保存的文件名
category_id string <optional>
文件所属类别 ID
random_file_link boolean <optional>
是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件,默认为 true
Source:

VideoMeta

视频元信息
Properties:
Name Type Description
duartion number m3u8 时长
points Array.<number> 时间点
Source:

VideoMetaParams

M3U8 时长和分片信息参数
Properties:
Name Type Description
m3u8s string 视频文件的 id 列表,按提交的顺序进行拼接
Source:

VideoMetaResult

M3U8 时长和分片信息请求结果
Properties:
Name Type Description
status_code number 状态码
message string 返回信息
meta BaaS.VideoMeta 元信息
Source:

VideoSnapshotParams

视频截图参数
Properties:
Name Type Attributes Description
source string 视频文件的 id
save_as string 截图保存的文件名
point string 截图时间格式,格式:HH:MM:SS
category_id string <optional>
文件所属类别 ID
random_file_link boolean <optional>
是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件,默认为 true
size string <optional>
截图尺寸,格式为 宽 x 高,默认是视频尺寸
format string <optional>
截sf格式,可选值为 jpg,png, webp, 默认根据 save_as 的后缀生成
Source: