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
}