API 参考

Calls

访问通话记录和 SIM 信息。需要 READ_CALL_LOG 权限。

类型定义

bash
type Call {
  id: ID!
  number: String!
  name: String!            # display name from contacts
  photoId: String!         # use GET /fs?id=<photoId>
  startedAt: String!       # ISO 8601
  duration: Int!           # seconds
  type: Int!               # 1=incoming 2=outgoing 3=missed 4=voicemail 5=rejected 6=blocked
  accountId: String!       # SIM slot / account id
  geo: String!             # geographic label for the number
}

type Sim {
  id: String!
  label: String!
  number: String!
  subscriptionId: Int!
}

操作

query

calls

搜索通话记录条目。查询留空可列出全部。

bash
query GetCalls($offset: Int!, $limit: Int!, $query: String!) {
  calls(offset: $offset, limit: $limit, query: $query) {
    id number name photoId startedAt duration type accountId geo
  }
}
query

callCount

统计匹配查询的通话数量。

bash
query GetCallCount($query: String!) {
  callCount(query: $query)
}
query

sims

列出设备上可用的所有 SIM 卡 / 电话帐户。

bash
query GetSims {
  sims { id label number subscriptionId }
}
mutation

call

向给定号码发起通话。将 showDialer 设为 true 可打开电话应用拨号器,而非立即拨号。需要 CALL_PHONE 权限。

bash
mutation Call($number: String!, $showDialer: Boolean!) {
  call(number: $number, showDialer: $showDialer)
}
mutation

deleteCalls

删除匹配查询的通话记录条目。

bash
mutation DeleteCalls($query: String!) {
  deleteCalls(query: $query)
}