API 參考
Pomodoro
控制內建的 Pomodoro 計時器:讀取設定、查看今日進度,以及開始/暫停/停止目前工作階段。
型別定義
bash
type PomodoroSettings {
workDuration: Int! # minutes
shortBreak: Int! # minutes
longBreak: Int! # minutes
roundsBeforeLongBreak: Int!
autoStartBreaks: Boolean!
autoStartWork: Boolean!
}
type PomodoroToday {
date: String! # ISO date (YYYY-MM-DD)
completedCount: Int! # completed work rounds today
currentRound: Int!
timeLeft: Int! # seconds remaining in the current phase
totalTime: Int! # seconds elapsed in the current phase
isRunning: Boolean!
isPause: Boolean!
state: PomodoroState! # WORK | SHORT_BREAK | LONG_BREAK | PAUSED
}
enum PomodoroState {
WORK
SHORT_BREAK
LONG_BREAK
PAUSED
}操作
query
pomodoroSettings
取得已儲存的 Pomodoro 設定(時長、自動開始旗標、回合數)。
bash
query GetPomodoroSettings {
pomodoroSettings {
workDuration shortBreak longBreak roundsBeforeLongBreak
autoStartBreaks autoStartWork
}
}query
pomodoroToday
取得今日的執行階段資訊:已完成回合數、目前階段、剩餘時間和執行狀態。
bash
query GetPomodoroToday {
pomodoroToday {
date completedCount currentRound timeLeft totalTime isRunning isPause state
}
}mutation
startPomodoro
啟動 Pomodoro 計時器。傳入 timeLeft(秒)可從暫停狀態恢復,傳入 0 可全新開始。
bash
mutation StartPomodoro($timeLeft: Int!) {
startPomodoro(timeLeft: $timeLeft)
}mutation
pausePomodoro
暫停執行中的 Pomodoro 計時器。
bash
mutation PausePomodoro {
pausePomodoro
}mutation
stopPomodoro
停止 Pomodoro 計時器並重設目前回合。
bash
mutation StopPomodoro {
stopPomodoro
}