settingsservice.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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. * CaptureScreen 截取屏幕并返回 PNG 数据 URI,供「主机」页预览。
  25. * display 为显示器索引,-1 表示全部屏幕。
  26. * @param {number} display
  27. * @returns {$CancellablePromise<string>}
  28. */
  29. export function CaptureScreen(display) {
  30. return $Call.ByID(2784207426, display);
  31. }
  32. /**
  33. * ClearAPILogs 清空 Gin 日志缓冲
  34. * @returns {$CancellablePromise<void>}
  35. */
  36. export function ClearAPILogs() {
  37. return $Call.ByID(1756290968);
  38. }
  39. /**
  40. * GenerateQRCode 把输入字符串生成 PNG 二维码,返回 data URI 供前端展示。
  41. * size 为图片边长(像素),<=0 时用默认值 300。
  42. * @param {string} text
  43. * @param {number} size
  44. * @returns {$CancellablePromise<string>}
  45. */
  46. export function GenerateQRCode(text, size) {
  47. return $Call.ByID(3713602369, text, size);
  48. }
  49. /**
  50. * GetAPILogs 返回 Gin 日志环形缓冲的全部内容
  51. * @returns {$CancellablePromise<string[]>}
  52. */
  53. export function GetAPILogs() {
  54. return $Call.ByID(524575579).then(/** @type {($result: any) => any} */(($result) => {
  55. return $$createType0($result);
  56. }));
  57. }
  58. /**
  59. * GetAPIStatus 返回内置 API 服务运行状态
  60. * @returns {$CancellablePromise<$models.APIStatus>}
  61. */
  62. export function GetAPIStatus() {
  63. return $Call.ByID(3299247002).then(/** @type {($result: any) => any} */(($result) => {
  64. return $$createType1($result);
  65. }));
  66. }
  67. /**
  68. * GetBiliDynamic 抓取 B站「关注的人最新动态」。
  69. * 需要设置里配置 B站登录 cookie(含 SESSDATA);cookie 为空或失效时回退热门视频。
  70. * @returns {$CancellablePromise<$models.BiliDynamicItem[]>}
  71. */
  72. export function GetBiliDynamic() {
  73. return $Call.ByID(258599011).then(/** @type {($result: any) => any} */(($result) => {
  74. return $$createType3($result);
  75. }));
  76. }
  77. /**
  78. * GetGithubFeeds 抓取设置中所有 GitHub 仓库的最新提交
  79. * @returns {$CancellablePromise<$models.RepoFeed[]>}
  80. */
  81. export function GetGithubFeeds() {
  82. return $Call.ByID(2441556896).then(/** @type {($result: any) => any} */(($result) => {
  83. return $$createType5($result);
  84. }));
  85. }
  86. /**
  87. * GetKLine 拉取指定股票的日 K 数据,count 为交易日数量
  88. * @param {string} code
  89. * @param {number} count
  90. * @returns {$CancellablePromise<$models.KLineBar[]>}
  91. */
  92. export function GetKLine(code, count) {
  93. return $Call.ByID(1009336803, code, count).then(/** @type {($result: any) => any} */(($result) => {
  94. return $$createType7($result);
  95. }));
  96. }
  97. /**
  98. * GetMinuteChart 拉取指定股票的分时数据(点击股市行打开分时图时调用)
  99. * @param {string} code
  100. * @returns {$CancellablePromise<$models.MinuteChart>}
  101. */
  102. export function GetMinuteChart(code) {
  103. return $Call.ByID(1171130824, code).then(/** @type {($result: any) => any} */(($result) => {
  104. return $$createType8($result);
  105. }));
  106. }
  107. /**
  108. * GetNews 抓取新闻标题,按设置的关键词标记命中项并优先排序
  109. * @returns {$CancellablePromise<$models.NewsItem[]>}
  110. */
  111. export function GetNews() {
  112. return $Call.ByID(1306230863).then(/** @type {($result: any) => any} */(($result) => {
  113. return $$createType10($result);
  114. }));
  115. }
  116. /**
  117. * GetNtfyChatTopic 返回当前监听的聊天室主题(空表示未监听)
  118. * @returns {$CancellablePromise<string>}
  119. */
  120. export function GetNtfyChatTopic() {
  121. return $Call.ByID(3733537608);
  122. }
  123. /**
  124. * GetNtfyNicknames 返回已记忆的昵称列表(用于前端下拉建议)
  125. * @returns {$CancellablePromise<string[]>}
  126. */
  127. export function GetNtfyNicknames() {
  128. return $Call.ByID(3922015524).then(/** @type {($result: any) => any} */(($result) => {
  129. return $$createType0($result);
  130. }));
  131. }
  132. /**
  133. * GetNtfyTopics 返回已记忆的主题列表(用于前端下拉建议)
  134. * @returns {$CancellablePromise<string[]>}
  135. */
  136. export function GetNtfyTopics() {
  137. return $Call.ByID(1599033699).then(/** @type {($result: any) => any} */(($result) => {
  138. return $$createType0($result);
  139. }));
  140. }
  141. /**
  142. * GetPCStatus 返回电源控制命令状态
  143. * @returns {$CancellablePromise<$models.PCStatus>}
  144. */
  145. export function GetPCStatus() {
  146. return $Call.ByID(4166939475).then(/** @type {($result: any) => any} */(($result) => {
  147. return $$createType11($result);
  148. }));
  149. }
  150. /**
  151. * GetRandomPoem 返回一首随机古诗(供主窗口前端加载 / 手动刷新调用)
  152. * @returns {$CancellablePromise<$models.PoemData>}
  153. */
  154. export function GetRandomPoem() {
  155. return $Call.ByID(3860766604).then(/** @type {($result: any) => any} */(($result) => {
  156. return $$createType12($result);
  157. }));
  158. }
  159. /**
  160. * GetSettings 返回当前配置(读取配置文件,不存在则返回默认值)
  161. * @returns {$CancellablePromise<$models.AppSettings>}
  162. */
  163. export function GetSettings() {
  164. return $Call.ByID(3034808949).then(/** @type {($result: any) => any} */(($result) => {
  165. return $$createType13($result);
  166. }));
  167. }
  168. /**
  169. * GetStocks 按已保存的股票代码拉取最新行情
  170. * @returns {$CancellablePromise<$models.StockQuote[]>}
  171. */
  172. export function GetStocks() {
  173. return $Call.ByID(3187718815).then(/** @type {($result: any) => any} */(($result) => {
  174. return $$createType15($result);
  175. }));
  176. }
  177. /**
  178. * GetTrendingRepos 抓取 GitHub Trending 页的热门仓库列表(英文简介已自动翻译为中文)
  179. * @returns {$CancellablePromise<$models.TrendingRepo[]>}
  180. */
  181. export function GetTrendingRepos() {
  182. return $Call.ByID(4191072422).then(/** @type {($result: any) => any} */(($result) => {
  183. return $$createType17($result);
  184. }));
  185. }
  186. /**
  187. * MarkGithubRepoChecked 标记某仓库已检视:把本地版本更新为最新 release 版本,消除「发现新版本」提示
  188. * @param {string} url
  189. * @param {string} latest
  190. * @returns {$CancellablePromise<void>}
  191. */
  192. export function MarkGithubRepoChecked(url, latest) {
  193. return $Call.ByID(1378316359, url, latest);
  194. }
  195. /**
  196. * PickWebDir 弹出目录选择对话框,返回选中的目录(取消返回空串)。
  197. * @returns {$CancellablePromise<string>}
  198. */
  199. export function PickWebDir() {
  200. return $Call.ByID(1493546416);
  201. }
  202. /**
  203. * ReadRecord 读取记录文件内容;文件不存在时返回空内容
  204. * @returns {$CancellablePromise<string>}
  205. */
  206. export function ReadRecord() {
  207. return $Call.ByID(92427381);
  208. }
  209. /**
  210. * ReadTodo 读取待办文件内容(每行一个任务);文件不存在时返回空
  211. * @returns {$CancellablePromise<string>}
  212. */
  213. export function ReadTodo() {
  214. return $Call.ByID(1630526072);
  215. }
  216. /**
  217. * RenderMarkdown 把 Markdown 文本渲染为安全 HTML 片段(用于「记录」页预览)。
  218. * 使用 gomarkdown 渲染,并启用 CommonMark 扩展(表格、任务列表、围栏代码等)。
  219. * @param {string} md
  220. * @returns {$CancellablePromise<string>}
  221. */
  222. export function RenderMarkdown(md) {
  223. return $Call.ByID(3516797141, md);
  224. }
  225. /**
  226. * SaveSettings 保存配置并立即生效:热键、窗口置顶、开机启动、页面地址、股票代码等
  227. * @param {$models.AppSettings} settings
  228. * @returns {$CancellablePromise<$models.AppSettings>}
  229. */
  230. export function SaveSettings(settings) {
  231. return $Call.ByID(2662658340, settings).then(/** @type {($result: any) => any} */(($result) => {
  232. return $$createType13($result);
  233. }));
  234. }
  235. /**
  236. * SaveTickerEnabled 保存滚动条开关状态(新闻条 / 股票条右侧「关闭」按钮调用)
  237. * @param {string} kind
  238. * @param {boolean} enabled
  239. * @returns {$CancellablePromise<void>}
  240. */
  241. export function SaveTickerEnabled(kind, enabled) {
  242. return $Call.ByID(3033168348, kind, enabled);
  243. }
  244. /**
  245. * SaveTickerPos 保存滚动条窗口拖动后的位置(只更新配置,不重建窗口)
  246. * @param {string} kind
  247. * @param {number} x
  248. * @param {number} y
  249. * @returns {$CancellablePromise<void>}
  250. */
  251. export function SaveTickerPos(kind, x, y) {
  252. return $Call.ByID(371275047, kind, x, y);
  253. }
  254. /**
  255. * SendNtfyChat 向聊天室(主题)发送一条消息,nickname 作为标题发送。
  256. * 与 SendNtfyMessage 的区别:昵称固定作为标题,便于聊天室按昵称区分发言者。
  257. * @param {string} topic
  258. * @param {string} nickname
  259. * @param {string} message
  260. * @returns {$CancellablePromise<void>}
  261. */
  262. export function SendNtfyChat(topic, nickname, message) {
  263. return $Call.ByID(2994892543, topic, nickname, message);
  264. }
  265. /**
  266. * SendNtfyMessage 向指定主题推送一条 ntfy 消息。
  267. * topic 为推送主题(频道名),title 可为空(使用主题名),message 为消息内容。
  268. * @param {string} topic
  269. * @param {string} title
  270. * @param {string} message
  271. * @returns {$CancellablePromise<void>}
  272. */
  273. export function SendNtfyMessage(topic, title, message) {
  274. return $Call.ByID(1563997112, topic, title, message);
  275. }
  276. /**
  277. * SetMobileMode 前端在窗口尺寸变化时调用:移动端(窄屏)隐藏主机 Tab 并禁止滚动条
  278. * @param {boolean} mobile
  279. * @returns {$CancellablePromise<void>}
  280. */
  281. export function SetMobileMode(mobile) {
  282. return $Call.ByID(2881494037, mobile);
  283. }
  284. /**
  285. * SetNtfyChatTopic 设置聊天室要监听的主题。
  286. * 传入空字符串则停止监听(无主题不监听)。
  287. * 若与当前监听主题相同则不做任何事;不同则先停止旧监听再启动新监听。
  288. * @param {string} topic
  289. * @returns {$CancellablePromise<void>}
  290. */
  291. export function SetNtfyChatTopic(topic) {
  292. return $Call.ByID(1718497116, topic);
  293. }
  294. /**
  295. * ShowWindow 供前端主动呼出窗口(例如通知点击后回到主界面)
  296. * @returns {$CancellablePromise<void>}
  297. */
  298. export function ShowWindow() {
  299. return $Call.ByID(3712560909);
  300. }
  301. /**
  302. * StartAPIService 启动 / 重启内置 API 服务(服务页手动启动)
  303. * @returns {$CancellablePromise<void>}
  304. */
  305. export function StartAPIService() {
  306. return $Call.ByID(3942830483);
  307. }
  308. /**
  309. * StartWebService 启动静态文件服务(默认页 index.html 或 readme.md)。
  310. * @param {string} dir
  311. * @returns {$CancellablePromise<$models.WebServiceInfo>}
  312. */
  313. export function StartWebService(dir) {
  314. return $Call.ByID(3007036157, dir).then(/** @type {($result: any) => any} */(($result) => {
  315. return $$createType18($result);
  316. }));
  317. }
  318. /**
  319. * StopAPIService 停止内置 API 服务(服务页手动停止)
  320. * @returns {$CancellablePromise<void>}
  321. */
  322. export function StopAPIService() {
  323. return $Call.ByID(1470228927);
  324. }
  325. /**
  326. * StopWebService 停止静态文件服务。
  327. * @returns {$CancellablePromise<void>}
  328. */
  329. export function StopWebService() {
  330. return $Call.ByID(1864477289);
  331. }
  332. /**
  333. * Translate 翻译文本:输入中文翻译为英文,输入英文翻译为中文(自动检测方向)。
  334. * 使用 MyMemory 免费 API,有每日配额限制。
  335. * @param {string} text
  336. * @returns {$CancellablePromise<$models.TranslateResult>}
  337. */
  338. export function Translate(text) {
  339. return $Call.ByID(3284480866, text).then(/** @type {($result: any) => any} */(($result) => {
  340. return $$createType19($result);
  341. }));
  342. }
  343. /**
  344. * WebServiceStatus 返回静态文件服务当前状态。
  345. * @returns {$CancellablePromise<$models.WebServiceInfo>}
  346. */
  347. export function WebServiceStatus() {
  348. return $Call.ByID(1311352355).then(/** @type {($result: any) => any} */(($result) => {
  349. return $$createType18($result);
  350. }));
  351. }
  352. /**
  353. * WriteRecord 把记录内容写回记录文件(目录不存在时自动创建)
  354. * @param {string} content
  355. * @returns {$CancellablePromise<void>}
  356. */
  357. export function WriteRecord(content) {
  358. return $Call.ByID(2400471626, content);
  359. }
  360. /**
  361. * WriteTodo 把待办内容写回待办文件(目录不存在时自动创建)
  362. * @param {string} content
  363. * @returns {$CancellablePromise<void>}
  364. */
  365. export function WriteTodo(content) {
  366. return $Call.ByID(3129393963, content);
  367. }
  368. // Private type creation functions
  369. const $$createType0 = $Create.Array($Create.Any);
  370. const $$createType1 = $models.APIStatus.createFrom;
  371. const $$createType2 = $models.BiliDynamicItem.createFrom;
  372. const $$createType3 = $Create.Array($$createType2);
  373. const $$createType4 = $models.RepoFeed.createFrom;
  374. const $$createType5 = $Create.Array($$createType4);
  375. const $$createType6 = $models.KLineBar.createFrom;
  376. const $$createType7 = $Create.Array($$createType6);
  377. const $$createType8 = $models.MinuteChart.createFrom;
  378. const $$createType9 = $models.NewsItem.createFrom;
  379. const $$createType10 = $Create.Array($$createType9);
  380. const $$createType11 = $models.PCStatus.createFrom;
  381. const $$createType12 = $models.PoemData.createFrom;
  382. const $$createType13 = $models.AppSettings.createFrom;
  383. const $$createType14 = $models.StockQuote.createFrom;
  384. const $$createType15 = $Create.Array($$createType14);
  385. const $$createType16 = $models.TrendingRepo.createFrom;
  386. const $$createType17 = $Create.Array($$createType16);
  387. const $$createType18 = $models.WebServiceInfo.createFrom;
  388. const $$createType19 = $models.TranslateResult.createFrom;