API リファレンス

画像

機能の対応状況は app.capabilities、認可は app.access とホストの権限で確認してください。例は合成値を使用しています。呼び出す前にパス、ID、入力、フィルターを置き換えてください。

型定義

graphql
type Subscription {
  imageModelsUpdated: ImageModelsUpdate!
}

type Mutation {
  cancelImageIndex: Boolean!
  cancelImageModelDownload: Boolean!
  disableImageSearch: Boolean!
  enableImageSearch: Boolean!
  importImageSearchModel: Boolean!
  startImageIndex(force: Boolean): Boolean!
}

type Query {
  imageCount(query: String!): Int!
  imageSearchStatus: ImageSearchStatus!
  images(query: String!, offset: Int!, limit: Int!, sortBy: ImageSortBy!): [Image!]!
}

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

type Image implements MediaItem {
	id: ID!
	title: String!
	path: String!
	size: Long!
	width: Int!
	height: Int!
	rotation: Int!
	bucketId: ID!
	createdAt: Instant!
	updatedAt: Instant!
	takenAt: Instant
	isFavorite: Boolean!
	tags: [Tag!]!
}

type ImageModelsUpdate {
	version: Long!
	status: ImageSearchStatusType!
	downloadProgress: Int!
	errorMessage: String!
	modelSize: Long!
	modelDir: String!
	isIndexing: Boolean!
	totalImages: Int!
	indexedImages: Int!
}

type ImageSearchStatus {
	status: ImageSearchStatusType!
	downloadProgress: Int!
	errorMessage: String!
	modelSize: Long!
	modelDir: String!
	isIndexing: Boolean!
	totalImages: Int!
	indexedImages: Int!
}

enum ImageSearchStatusType {
	UNAVAILABLE
	DOWNLOADING
	LOADING
	READY
	ERROR
}

enum ImageSortBy {
	UPDATED_AT_ASC
	UPDATED_AT_DESC
	SIZE_ASC
	SIZE_DESC
	NAME_ASC
	NAME_DESC
	TAKEN_AT_DESC
}

scalar Instant

scalar Long

interface MediaItem {
	id: ID!
	title: String!
	path: String!
	size: Long!
	bucketId: ID!
	createdAt: Instant!
	updatedAt: Instant!
}

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

操作

subscription

imageModelsUpdated

画像検索モデルのダウンロードまたは利用可能状態の更新を受信します。

graphql
subscription imageModelsUpdated {
  imageModelsUpdated { version status downloadProgress errorMessage modelSize modelDir isIndexing totalImages }
}
mutation

cancelImageIndex

実行中のインデックス作成をキャンセルします。

graphql
mutation cancelImageIndex {
  cancelImageIndex
}
mutation

cancelImageModelDownload

進行中の AI モデルダウンロードをキャンセルします。

graphql
mutation cancelImageModelDownload {
  cancelImageModelDownload
}
mutation

disableImageSearch

AI による意味的な画像検索を無効にし、リソースを解放します。

graphql
mutation disableImageSearch {
  disableImageSearch
}
mutation

enableImageSearch

AI による意味的な画像検索を有効にします。モデルがデバイスになければダウンロードします。

graphql
mutation enableImageSearch {
  enableImageSearch
}
mutation

importImageSearchModel

アップロード済みの完全な画像検索モデルパッケージを検証し、有効にします。

graphql
mutation importImageSearchModel {
  importImageSearchModel
}
mutation

startImageIndex

AI 検索用の画像インデックス作成を開始します。すべて再作成するには force=true を渡します。

graphql
# `force` re-scans images that already have an embedding.
mutation startImageIndex($force: Boolean) {
  startImageIndex(force: $force)
}
query

imageCount

クエリに一致する画像数を数えます。

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

imageSearchStatus

AI による意味検索の現在のインデックス作成状態を取得します。

graphql
query imageSearchStatus {
  imageSearchStatus { status downloadProgress errorMessage modelSize modelDir isIndexing totalImages indexedImages }
}
query

images

画像カタログを、フィルター、ページ指定、並べ替えで検索します。

graphql
query images($query: String!, $offset: Int!, $limit: Int!, $sortBy: ImageSortBy!) {
  images(query: $query, offset: $offset, limit: $limit, sortBy: $sortBy) { id title path size width height rotation bucketId }
}