API リファレンス

SMS

SMS and MMS APIs.

型定義

graphql
type Subscription {
  smsChanged: SmsProviderChange
  smsSendResult: SmsSendResult!
}

type Mutation {
  archiveSmsConversation(id: ID!, date: Instant): Boolean!
  deleteSms(query: String!): ActionResult!
  restoreSms(query: String!): ActionResult!
  sendSms(number: String!, body: String!, attachmentPaths: [String!]! = [], subscriptionId: Int, requestId: String!): SmsSendReceipt!
  trashSms(query: String!): ActionResult!
  unarchiveSmsConversation(id: ID!): Boolean!
}

type Query {
  archivedSmsConversations(query: String!, offset: Int!, limit: Int!): [SmsConversation!]!
  sims: [Sim!]!
  sms(query: String!, offset: Int!, limit: Int!): [Sms!]!
  smsBoxCounts: SmsCounts!
  smsConversationCount(query: String!): Int!
  smsConversations(query: String!, offset: Int!, limit: Int!): [SmsConversation!]!
  smsCount(query: String!): Int!
}

type ActionResult {
	affectedCount: Int!
}

enum DataType {
	DEFAULT
	AUDIO
	VIDEO
	IMAGE
	SMS
	CONTACT
	NOTE
	FEED_ENTRY
	CALL
	PACKAGE
	FILE
	APP_FILE
	DOC
}

scalar Instant

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

type Sms {
	id: ID!
	body: String!
	address: String!
	sentAt: Instant!
	serviceCenter: String!
	read: Boolean!
	threadId: ID!
	type: SmsType!
	typeCode: Int!
	subscriptionId: Int!
	isMms: Boolean!
	attachments: [SmsAttachment!]!
	tags: [Tag!]!
}

type SmsAttachment {
	path: String!
	contentType: String!
	name: String!
}

type SmsConversation {
	id: ID!
	address: String!
	snippet: String!
	lastMessageAt: Instant!
	messageCount: Int!
	read: Boolean!
	addresses: [String!]!
}

type SmsCounts {
	total: Int!
	inbox: Int!
	sent: Int!
	drafts: Int!
}

type SmsProviderChange {
	uris: [String!]!
}

type SmsSendReceipt {
	requestId: String!
	requiresConfirmation: Boolean!
}

type SmsSendResult {
	requestId: String!
	success: Boolean!
	resultCode: Int
}

enum SmsType {
	INBOX
	SENT
	DRAFT
	OUTBOX
	FAILED
	QUEUED
	UNKNOWN
}

type Tag {
	id: ID!
	name: String!
	type: DataType!
	count: Int!
}

操作

subscription

smsChanged

端末のSMSに変更があると、クライアントにSMS一覧の更新を通知します。本文は返しません。

graphql
subscription smsChanged {
  smsChanged { uris }
}
subscription

smsSendResult

SMS/MMS の送信結果を受信し、requestId で照合します。判定には success を使います。SMS 成功は -1、MMS 成功は 0、タイムアウトは -1000、キャンセルは -1001 です。送信成功は配信完了を意味しません。

graphql
subscription smsSendResult {
  smsSendResult { requestId success resultCode }
}
mutation

archiveSmsConversation

メッセージ会話をアーカイブし、任意でアーカイブ日を記録します。

graphql
mutation archiveSmsConversation($id: ID!, $date: Instant) {
  archiveSmsConversation(id: $id, date: $date)
}
mutation

deleteSms

クエリに一致する SMS メッセージを完全に削除します。

graphql
mutation deleteSms($query: String!) {
  deleteSms(query: $query) { affectedCount }
}
mutation

restoreSms

クエリに一致するゴミ箱内の SMS メッセージを復元します。

graphql
mutation restoreSms($query: String!) {
  restoreSms(query: $query) { affectedCount }
}
mutation

sendSms

SMS を送信するか、添付付きの MMS 作成画面を電話で開きます。

graphql
mutation sendSms($number: String!, $body: String!, $attachmentPaths: [String!]!, $subscriptionId: Int, $requestId: String!) {
  sendSms(number: $number, body: $body, attachmentPaths: $attachmentPaths, subscriptionId: $subscriptionId, requestId: $requestId) { requestId requiresConfirmation }
}
mutation

trashSms

クエリに一致する SMS メッセージをゴミ箱に移動します。

graphql
mutation trashSms($query: String!) {
  trashSms(query: $query) { affectedCount }
}
mutation

unarchiveSmsConversation

会話のアーカイブ状態を解除します。

graphql
mutation unarchiveSmsConversation($id: ID!) {
  unarchiveSmsConversation(id: $id)
}
query

archivedSmsConversations

アーカイブ済みの SMS 会話をページ単位で検索します。

graphql
query archivedSmsConversations($query: String!, $offset: Int!, $limit: Int!) {
  archivedSmsConversations(query: $query, offset: $offset, limit: $limit) { id address snippet lastMessageAt messageCount read addresses }
}
query

sims

デバイスで利用可能な SIM カードと電話アカウントを一覧表示します。

graphql
query sims {
  sims { id label number subscriptionId }
}
query

sms

SMS メッセージを検索します。すべて表示するには query に空文字列を使用します。

graphql
query sms($query: String!, $offset: Int!, $limit: Int!) {
  sms(query: $query, offset: $offset, limit: $limit) { id body address sentAt serviceCenter read threadId type }
}
query

smsBoxCounts

利用可能な SMS ボックスのメッセージ数を読み取ります。

graphql
query smsBoxCounts {
  smsBoxCounts { total inbox sent drafts }
}
query

smsConversationCount

クエリに一致する SMS 会話数を数えます。

graphql
query smsConversationCount($query: String!) {
  smsConversationCount(query: $query)
}
query

smsConversations

SMS 会話(スレッド)をページ単位で一覧表示します。

graphql
query smsConversations($query: String!, $offset: Int!, $limit: Int!) {
  smsConversations(query: $query, offset: $offset, limit: $limit) { id address snippet lastMessageAt messageCount read addresses }
}
query

smsCount

クエリに一致する SMS メッセージ数を数えます。

graphql
query smsCount($query: String!) {
  smsCount(query: $query)
}