API 参考
通话
通过 app.capabilities 判断功能支持,通过 app.access 和宿主权限判断访问授权。示例使用合成数据,调用前请替换路径、ID、输入和筛选条件。
类型定义
graphql
type Mutation {
call(number: String!, showDialer: Boolean!): Boolean!
deleteCalls(query: String!): ActionResult!
}
type Query {
callCount(query: String!): Int!
calls(query: String!, offset: Int!, limit: Int!): [Call!]!
}
type ActionResult {
affectedCount: Int!
}
type Call {
typeCode: Int!
id: ID!
number: String!
name: String!
photo: String!
startedAt: Instant!
durationSec: Int!
type: CallType!
accountId: ID!
geo: PhoneGeo
tags: [Tag!]!
}
enum CallType {
INCOMING
OUTGOING
MISSED
VOICEMAIL
REJECTED
BLOCKED
ANSWERED_EXTERNALLY
UNKNOWN
}
enum DataType {
DEFAULT
AUDIO
VIDEO
IMAGE
SMS
CONTACT
NOTE
FEED_ENTRY
CALL
PACKAGE
FILE
APP_FILE
DOC
}
scalar Instant
type PhoneGeo {
country: String!
numberType: PhoneNumberType!
carrier: String!
description: String!
}
enum PhoneNumberType {
FIXED_LINE
MOBILE
FIXED_LINE_OR_MOBILE
TOLL_FREE
PREMIUM_RATE
SHARED_COST
PERSONAL_NUMBER
VOIP
PAGER
UAN
VOICEMAIL
}
type Tag {
id: ID!
name: String!
type: DataType!
count: Int!
}操作
mutation
call
呼叫指定号码。showDialer=true 时仅打开拨号界面,不立即呼叫。需要 CALL_PHONE 权限。
graphql
# `showDialer` hands the number to the dialer instead of placing the
# call outright.
mutation call($number: String!, $showDialer: Boolean!) {
call(number: $number, showDialer: $showDialer)
}mutation
deleteCalls
删除符合查询条件的通话记录。
graphql
mutation deleteCalls($query: String!) {
deleteCalls(query: $query) { affectedCount }
}query
callCount
统计符合查询条件的通话数。
graphql
query callCount($query: String!) {
callCount(query: $query)
}query
calls
搜索通话记录;query 留空时列出全部记录。
graphql
query calls($query: String!, $offset: Int!, $limit: Int!) {
calls(query: $query, offset: $offset, limit: $limit) { typeCode id number name photo startedAt durationSec type }
}