settingsservice.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. // @ts-check
  2. // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
  3. // This file is automatically generated. DO NOT EDIT
  4. /**
  5. * SettingsService 暴露「设置」页需要的后端能力给前端调用。
  6. * 前端通过 bindings 调用 GetSettings / SaveSettings / GetStocks 等方法。
  7. * @module
  8. */
  9. // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  10. // @ts-ignore: Unused imports
  11. import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
  12. // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  13. // @ts-ignore: Unused imports
  14. import * as $models from "./models.js";
  15. /**
  16. * AppVersion 返回应用版本号,供 footer 展示。
  17. * 版本常量在 settings.go 的 AppVersion(与 build/windows/info.json 的 ProductVersion 一致)。
  18. * @returns {$CancellablePromise<string>}
  19. */
  20. export function AppVersion() {
  21. return $Call.ByID(609040257);
  22. }
  23. /**
  24. * BackupFile 把指定文本文件按当前时间备份到配置的备份目录。
  25. * 备份文件名带时间戳:<原名>_YYYYMMDD_HHMMSS<扩展名>;目录不存在时自动创建。
  26. * 返回备份后的完整路径,供前端提示。
  27. * @param {string} path
  28. * @returns {$CancellablePromise<string>}
  29. */
  30. export function BackupFile(path) {
  31. return $Call.ByID(122452644, path);
  32. }
  33. /**
  34. * CancelShutdown 取消延时关机(工具页「取消」按钮调用)。
  35. * @returns {$CancellablePromise<void>}
  36. */
  37. export function CancelShutdown() {
  38. return $Call.ByID(1266387008);
  39. }
  40. /**
  41. * CaptureScreen 截取屏幕并返回 PNG 数据 URI,供「主机」页预览。
  42. * display 为显示器索引,-1 表示全部屏幕。
  43. * @param {number} display
  44. * @returns {$CancellablePromise<string>}
  45. */
  46. export function CaptureScreen(display) {
  47. return $Call.ByID(2784207426, display);
  48. }
  49. /**
  50. * ClearAPILogs 清空 Gin 日志缓冲
  51. * @returns {$CancellablePromise<void>}
  52. */
  53. export function ClearAPILogs() {
  54. return $Call.ByID(1756290968);
  55. }
  56. /**
  57. * GenerateQRCode 把输入字符串生成 PNG 二维码,返回 data URI 供前端展示。
  58. * size 为图片边长(像素),<=0 时用默认值 300。
  59. * @param {string} text
  60. * @param {number} size
  61. * @returns {$CancellablePromise<string>}
  62. */
  63. export function GenerateQRCode(text, size) {
  64. return $Call.ByID(3713602369, text, size);
  65. }
  66. /**
  67. * GetAPILogs 返回 Gin 日志环形缓冲的全部内容
  68. * @returns {$CancellablePromise<string[]>}
  69. */
  70. export function GetAPILogs() {
  71. return $Call.ByID(524575579).then(/** @type {($result: any) => any} */(($result) => {
  72. return $$createType0($result);
  73. }));
  74. }
  75. /**
  76. * GetAPIStatus 返回内置 API 服务运行状态
  77. * @returns {$CancellablePromise<$models.APIStatus>}
  78. */
  79. export function GetAPIStatus() {
  80. return $Call.ByID(3299247002).then(/** @type {($result: any) => any} */(($result) => {
  81. return $$createType1($result);
  82. }));
  83. }
  84. /**
  85. * GetBiliDynamic 抓取 B站「关注的人最新动态」。
  86. * 需要设置里配置 B站登录 cookie(含 SESSDATA);cookie 为空或失效时回退热门视频。
  87. * @returns {$CancellablePromise<$models.BiliDynamicItem[]>}
  88. */
  89. export function GetBiliDynamic() {
  90. return $Call.ByID(258599011).then(/** @type {($result: any) => any} */(($result) => {
  91. return $$createType3($result);
  92. }));
  93. }
  94. /**
  95. * GetGithubFeeds 抓取设置中所有 GitHub 仓库的最新提交
  96. * @returns {$CancellablePromise<$models.RepoFeed[]>}
  97. */
  98. export function GetGithubFeeds() {
  99. return $Call.ByID(2441556896).then(/** @type {($result: any) => any} */(($result) => {
  100. return $$createType5($result);
  101. }));
  102. }
  103. /**
  104. * GetKLine 拉取指定股票的日 K 数据,count 为交易日数量
  105. * @param {string} code
  106. * @param {number} count
  107. * @returns {$CancellablePromise<$models.KLineBar[]>}
  108. */
  109. export function GetKLine(code, count) {
  110. return $Call.ByID(1009336803, code, count).then(/** @type {($result: any) => any} */(($result) => {
  111. return $$createType7($result);
  112. }));
  113. }
  114. /**
  115. * GetMinuteChart 拉取指定股票的分时数据(点击股市行打开分时图时调用)
  116. * @param {string} code
  117. * @returns {$CancellablePromise<$models.MinuteChart>}
  118. */
  119. export function GetMinuteChart(code) {
  120. return $Call.ByID(1171130824, code).then(/** @type {($result: any) => any} */(($result) => {
  121. return $$createType8($result);
  122. }));
  123. }
  124. /**
  125. * GetNews 抓取新闻标题,按设置的关键词标记命中项并优先排序
  126. * @returns {$CancellablePromise<$models.NewsItem[]>}
  127. */
  128. export function GetNews() {
  129. return $Call.ByID(1306230863).then(/** @type {($result: any) => any} */(($result) => {
  130. return $$createType10($result);
  131. }));
  132. }
  133. /**
  134. * GetNtfyChatTopic 返回当前监听的聊天室主题(空表示未监听)
  135. * @returns {$CancellablePromise<string>}
  136. */
  137. export function GetNtfyChatTopic() {
  138. return $Call.ByID(3733537608);
  139. }
  140. /**
  141. * GetNtfyNicknames 返回已记忆的昵称列表(用于前端下拉建议)
  142. * @returns {$CancellablePromise<string[]>}
  143. */
  144. export function GetNtfyNicknames() {
  145. return $Call.ByID(3922015524).then(/** @type {($result: any) => any} */(($result) => {
  146. return $$createType0($result);
  147. }));
  148. }
  149. /**
  150. * GetNtfyTopics 返回已记忆的主题列表(用于前端下拉建议)
  151. * @returns {$CancellablePromise<string[]>}
  152. */
  153. export function GetNtfyTopics() {
  154. return $Call.ByID(1599033699).then(/** @type {($result: any) => any} */(($result) => {
  155. return $$createType0($result);
  156. }));
  157. }
  158. /**
  159. * GetPCStatus 返回电源控制命令状态
  160. * @returns {$CancellablePromise<$models.PCStatus>}
  161. */
  162. export function GetPCStatus() {
  163. return $Call.ByID(4166939475).then(/** @type {($result: any) => any} */(($result) => {
  164. return $$createType11($result);
  165. }));
  166. }
  167. /**
  168. * GetRandomPoem 返回一首随机古诗(供主窗口前端加载 / 手动刷新调用)
  169. * @returns {$CancellablePromise<$models.PoemData>}
  170. */
  171. export function GetRandomPoem() {
  172. return $Call.ByID(3860766604).then(/** @type {($result: any) => any} */(($result) => {
  173. return $$createType12($result);
  174. }));
  175. }
  176. /**
  177. * GetRecordItems 返回所有历史名称(去重排序),供名称输入框自动补全。
  178. * @returns {$CancellablePromise<string[]>}
  179. */
  180. export function GetRecordItems() {
  181. return $Call.ByID(1250968375).then(/** @type {($result: any) => any} */(($result) => {
  182. return $$createType0($result);
  183. }));
  184. }
  185. /**
  186. * GetRecordNames 返回所有历史姓名(去重排序),供姓名输入框自动补全。
  187. * @returns {$CancellablePromise<string[]>}
  188. */
  189. export function GetRecordNames() {
  190. return $Call.ByID(2424781591).then(/** @type {($result: any) => any} */(($result) => {
  191. return $$createType0($result);
  192. }));
  193. }
  194. /**
  195. * GetSettings 返回当前配置(读取配置文件,不存在则返回默认值)
  196. * @returns {$CancellablePromise<$models.AppSettings>}
  197. */
  198. export function GetSettings() {
  199. return $Call.ByID(3034808949).then(/** @type {($result: any) => any} */(($result) => {
  200. return $$createType13($result);
  201. }));
  202. }
  203. /**
  204. * GetStocks 按已保存的股票代码拉取最新行情
  205. * @returns {$CancellablePromise<$models.StockQuote[]>}
  206. */
  207. export function GetStocks() {
  208. return $Call.ByID(3187718815).then(/** @type {($result: any) => any} */(($result) => {
  209. return $$createType15($result);
  210. }));
  211. }
  212. /**
  213. * GetTrendingRepos 抓取 GitHub Trending 页的热门仓库列表(英文简介已自动翻译为中文)
  214. * @returns {$CancellablePromise<$models.TrendingRepo[]>}
  215. */
  216. export function GetTrendingRepos() {
  217. return $Call.ByID(4191072422).then(/** @type {($result: any) => any} */(($result) => {
  218. return $$createType17($result);
  219. }));
  220. }
  221. /**
  222. * MarkGithubRepoChecked 标记某仓库已检视:把本地版本更新为最新 release 版本,消除「发现新版本」提示
  223. * @param {string} url
  224. * @param {string} latest
  225. * @returns {$CancellablePromise<void>}
  226. */
  227. export function MarkGithubRepoChecked(url, latest) {
  228. return $Call.ByID(1378316359, url, latest);
  229. }
  230. /**
  231. * PickWebDir 弹出目录选择对话框,返回选中的目录(取消返回空串)。
  232. * @returns {$CancellablePromise<string>}
  233. */
  234. export function PickWebDir() {
  235. return $Call.ByID(1493546416);
  236. }
  237. /**
  238. * ReadRecords 读取全部记录(按 id 升序,保持录入顺序)。
  239. * 前端 loadRecords 渲染列表;柱状图按返回顺序绘制。
  240. * @returns {$CancellablePromise<$models.RecordItem[]>}
  241. */
  242. export function ReadRecords() {
  243. return $Call.ByID(2989114738).then(/** @type {($result: any) => any} */(($result) => {
  244. return $$createType19($result);
  245. }));
  246. }
  247. /**
  248. * ReadTextFile 读取任意文本文件内容(供「自定义 Tab」文件类型页面使用)。
  249. * 文件不存在时返回空内容;其他错误原样返回。
  250. * @param {string} path
  251. * @returns {$CancellablePromise<string>}
  252. */
  253. export function ReadTextFile(path) {
  254. return $Call.ByID(3179291801, path);
  255. }
  256. /**
  257. * ReadTodo 读取待办文件内容(每行一个任务);文件不存在时返回空
  258. * @returns {$CancellablePromise<string>}
  259. */
  260. export function ReadTodo() {
  261. return $Call.ByID(1630526072);
  262. }
  263. /**
  264. * RenderMarkdown 把 Markdown 文本渲染为安全 HTML 片段(供文件类自定义 Tab 展示)。
  265. * 使用 gomarkdown 渲染,并启用 CommonMark 扩展(表格、任务列表、围栏代码等)。
  266. * @param {string} md
  267. * @returns {$CancellablePromise<string>}
  268. */
  269. export function RenderMarkdown(md) {
  270. return $Call.ByID(3516797141, md);
  271. }
  272. /**
  273. * SaveSettings 保存配置并立即生效:热键、窗口置顶、开机启动、页面地址、股票代码等
  274. * @param {$models.AppSettings} settings
  275. * @returns {$CancellablePromise<$models.AppSettings>}
  276. */
  277. export function SaveSettings(settings) {
  278. return $Call.ByID(2662658340, settings).then(/** @type {($result: any) => any} */(($result) => {
  279. return $$createType13($result);
  280. }));
  281. }
  282. /**
  283. * SaveTickerEnabled 保存滚动条开关状态(新闻条 / 股票条右侧「关闭」按钮调用)
  284. * @param {string} kind
  285. * @param {boolean} enabled
  286. * @returns {$CancellablePromise<void>}
  287. */
  288. export function SaveTickerEnabled(kind, enabled) {
  289. return $Call.ByID(3033168348, kind, enabled);
  290. }
  291. /**
  292. * SaveTickerPos 保存滚动条窗口拖动后的位置(只更新配置,不重建窗口)
  293. * @param {string} kind
  294. * @param {number} x
  295. * @param {number} y
  296. * @returns {$CancellablePromise<void>}
  297. */
  298. export function SaveTickerPos(kind, x, y) {
  299. return $Call.ByID(371275047, kind, x, y);
  300. }
  301. /**
  302. * SendNtfyChat 向聊天室(主题)发送一条消息,nickname 作为标题发送。
  303. * 与 SendNtfyMessage 的区别:昵称固定作为标题,便于聊天室按昵称区分发言者。
  304. * @param {string} topic
  305. * @param {string} nickname
  306. * @param {string} message
  307. * @returns {$CancellablePromise<void>}
  308. */
  309. export function SendNtfyChat(topic, nickname, message) {
  310. return $Call.ByID(2994892543, topic, nickname, message);
  311. }
  312. /**
  313. * SendNtfyMessage 向指定主题推送一条 ntfy 消息。
  314. * topic 为推送主题(频道名),title 可为空(使用主题名),message 为消息内容。
  315. * @param {string} topic
  316. * @param {string} title
  317. * @param {string} message
  318. * @returns {$CancellablePromise<void>}
  319. */
  320. export function SendNtfyMessage(topic, title, message) {
  321. return $Call.ByID(1563997112, topic, title, message);
  322. }
  323. /**
  324. * SetMobileMode 前端在窗口尺寸变化时调用:移动端(窄屏)隐藏主机 Tab 并禁止滚动条
  325. * @param {boolean} mobile
  326. * @returns {$CancellablePromise<void>}
  327. */
  328. export function SetMobileMode(mobile) {
  329. return $Call.ByID(2881494037, mobile);
  330. }
  331. /**
  332. * SetNtfyChatTopic 设置聊天室要监听的主题。
  333. * 传入空字符串则停止监听(无主题不监听)。
  334. * 若与当前监听主题相同则不做任何事;不同则先停止旧监听再启动新监听。
  335. * @param {string} topic
  336. * @returns {$CancellablePromise<void>}
  337. */
  338. export function SetNtfyChatTopic(topic) {
  339. return $Call.ByID(1718497116, topic);
  340. }
  341. /**
  342. * ShowWindow 供前端主动呼出窗口(例如通知点击后回到主界面)
  343. * @returns {$CancellablePromise<void>}
  344. */
  345. export function ShowWindow() {
  346. return $Call.ByID(3712560909);
  347. }
  348. /**
  349. * ShutdownDelay 在指定分钟后执行关机。
  350. * minutes 必须 > 0;返回计划执行时间(HH:MM:SS)与提示信息。
  351. * @param {number} minutes
  352. * @returns {$CancellablePromise<string>}
  353. */
  354. export function ShutdownDelay(minutes) {
  355. return $Call.ByID(3801676825, minutes);
  356. }
  357. /**
  358. * StartAPIService 启动 / 重启内置 API 服务(服务页手动启动)
  359. * @returns {$CancellablePromise<void>}
  360. */
  361. export function StartAPIService() {
  362. return $Call.ByID(3942830483);
  363. }
  364. /**
  365. * StartWebService 启动静态文件服务(默认页 index.html 或 readme.md)。
  366. * @param {string} dir
  367. * @returns {$CancellablePromise<$models.WebServiceInfo>}
  368. */
  369. export function StartWebService(dir) {
  370. return $Call.ByID(3007036157, dir).then(/** @type {($result: any) => any} */(($result) => {
  371. return $$createType20($result);
  372. }));
  373. }
  374. /**
  375. * StopAPIService 停止内置 API 服务(服务页手动停止)
  376. * @returns {$CancellablePromise<void>}
  377. */
  378. export function StopAPIService() {
  379. return $Call.ByID(1470228927);
  380. }
  381. /**
  382. * StopWebService 停止静态文件服务。
  383. * @returns {$CancellablePromise<void>}
  384. */
  385. export function StopWebService() {
  386. return $Call.ByID(1864477289);
  387. }
  388. /**
  389. * Translate 翻译文本:输入中文翻译为英文,输入英文翻译为中文(自动检测方向)。
  390. * 使用 MyMemory 免费 API,有每日配额限制。
  391. * @param {string} text
  392. * @returns {$CancellablePromise<$models.TranslateResult>}
  393. */
  394. export function Translate(text) {
  395. return $Call.ByID(3284480866, text).then(/** @type {($result: any) => any} */(($result) => {
  396. return $$createType21($result);
  397. }));
  398. }
  399. /**
  400. * WebServiceStatus 返回静态文件服务当前状态。
  401. * @returns {$CancellablePromise<$models.WebServiceInfo>}
  402. */
  403. export function WebServiceStatus() {
  404. return $Call.ByID(1311352355).then(/** @type {($result: any) => any} */(($result) => {
  405. return $$createType20($result);
  406. }));
  407. }
  408. /**
  409. * WriteRecords 全量替换记录:开启事务,先清空再批量插入。
  410. * 前端 saveRecords 提交当前列表全部行,保证与数据库完全一致。
  411. * @param {$models.RecordItem[]} items
  412. * @returns {$CancellablePromise<void>}
  413. */
  414. export function WriteRecords(items) {
  415. return $Call.ByID(1978718139, items);
  416. }
  417. /**
  418. * WriteTextFile 把文本内容写回指定文件(目录不存在时自动创建)。
  419. * 供文件类自定义 Tab 的「保存」使用。
  420. * @param {string} path
  421. * @param {string} content
  422. * @returns {$CancellablePromise<void>}
  423. */
  424. export function WriteTextFile(path, content) {
  425. return $Call.ByID(1781087370, path, content);
  426. }
  427. /**
  428. * WriteTodo 把待办内容写回待办文件(目录不存在时自动创建)
  429. * @param {string} content
  430. * @returns {$CancellablePromise<void>}
  431. */
  432. export function WriteTodo(content) {
  433. return $Call.ByID(3129393963, content);
  434. }
  435. // Private type creation functions
  436. const $$createType0 = $Create.Array($Create.Any);
  437. const $$createType1 = $models.APIStatus.createFrom;
  438. const $$createType2 = $models.BiliDynamicItem.createFrom;
  439. const $$createType3 = $Create.Array($$createType2);
  440. const $$createType4 = $models.RepoFeed.createFrom;
  441. const $$createType5 = $Create.Array($$createType4);
  442. const $$createType6 = $models.KLineBar.createFrom;
  443. const $$createType7 = $Create.Array($$createType6);
  444. const $$createType8 = $models.MinuteChart.createFrom;
  445. const $$createType9 = $models.NewsItem.createFrom;
  446. const $$createType10 = $Create.Array($$createType9);
  447. const $$createType11 = $models.PCStatus.createFrom;
  448. const $$createType12 = $models.PoemData.createFrom;
  449. const $$createType13 = $models.AppSettings.createFrom;
  450. const $$createType14 = $models.StockQuote.createFrom;
  451. const $$createType15 = $Create.Array($$createType14);
  452. const $$createType16 = $models.TrendingRepo.createFrom;
  453. const $$createType17 = $Create.Array($$createType16);
  454. const $$createType18 = $models.RecordItem.createFrom;
  455. const $$createType19 = $Create.Array($$createType18);
  456. const $$createType20 = $models.WebServiceInfo.createFrom;
  457. const $$createType21 = $models.TranslateResult.createFrom;