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