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)
}