Tham chiếu API

Pomodoro

Kiểm tra app.capabilities để biết tính năng và app.access cùng quyền máy chủ để xác định quyền truy cập. Thay giá trị mẫu trước khi gọi.

Định nghĩa kiểu

graphql
type Subscription {
  pomodoroSettingsChanged: Boolean!
  pomodoroAction: PomodoroAction!
}

type Mutation {
  pausePomodoro: PomodoroToday!
  setPomodoroRemainingTime(remainingSec: Int!): PomodoroToday!
  startPomodoro(durationSec: Int!): PomodoroToday!
  stopPomodoro: PomodoroToday!
}

type Query {
  pomodoroSettings: PomodoroSettings!
  pomodoroToday: PomodoroToday!
}

scalar Instant

type PomodoroAction {
	today: PomodoroToday!
	completedState: PomodoroState
}

type PomodoroSettings {
	workDurationMin: Int!
	shortBreakDurationMin: Int!
	longBreakDurationMin: Int!
	pomodorosBeforeLongBreak: Int!
	showNotification: Boolean!
	playSoundOnComplete: Boolean!
	soundPath: String!
	originalSoundName: String!
}

enum PomodoroState {
	WORK
	SHORT_BREAK
	LONG_BREAK
}

type PomodoroToday {
	date: Instant!
	completedCount: Int!
	currentRound: Int!
	timeLeftSec: Int!
	totalTimeSec: Int!
	isRunning: Boolean!
	isPaused: Boolean!
	state: PomodoroState!
}

Thao tác

subscription

pomodoroSettingsChanged

Nhận tín hiệu khi cài đặt Pomodoro thay đổi.

graphql
subscription pomodoroSettingsChanged {
  pomodoroSettingsChanged
}
subscription

pomodoroAction

Nhận cập nhật hành động bộ đếm Pomodoro.

graphql
subscription pomodoroAction {
  pomodoroAction { completedState }
}
mutation

pausePomodoro

Tạm dừng bộ đếm Pomodoro đang chạy.

graphql
mutation pausePomodoro {
  pausePomodoro { date completedCount currentRound timeLeftSec totalTimeSec isRunning isPaused state }
}
mutation

setPomodoroRemainingTime

Đặt thời gian còn lại theo giây của bộ đếm đang chạy hoặc tạm dừng, từ không đến độ dài vòng hiện tại.

graphql
mutation setPomodoroRemainingTime($remainingSec: Int!) {
  setPomodoroRemainingTime(remainingSec: $remainingSec) { date completedCount currentRound timeLeftSec totalTimeSec isRunning isPaused state }
}
mutation

startPomodoro

Bắt đầu bộ đếm Pomodoro với thời lượng giây được cung cấp.

graphql
mutation startPomodoro($durationSec: Int!) {
  startPomodoro(durationSec: $durationSec) { date completedCount currentRound timeLeftSec totalTimeSec isRunning isPaused state }
}
mutation

stopPomodoro

Dừng bộ đếm Pomodoro và đặt lại vòng hiện tại.

graphql
mutation stopPomodoro {
  stopPomodoro { date completedCount currentRound timeLeftSec totalTimeSec isRunning isPaused state }
}
query

pomodoroSettings

Lấy cài đặt Pomodoro đã lưu (thời lượng, cờ tự bắt đầu, vòng).

graphql
query pomodoroSettings {
  pomodoroSettings { workDurationMin shortBreakDurationMin longBreakDurationMin pomodorosBeforeLongBreak showNotification playSoundOnComplete soundPath originalSoundName }
}
query

pomodoroToday

Lấy thông tin hoạt động hôm nay: vòng hoàn tất, giai đoạn hiện tại, thời gian còn lại và trạng thái chạy.

graphql
query pomodoroToday {
  pomodoroToday { date completedCount currentRound timeLeftSec totalTimeSec isRunning isPaused state }
}