1
0

resourcesservice.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // @ts-check
  2. // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
  3. // This file is automatically generated. DO NOT EDIT
  4. /**
  5. * ResourcesService 是「设置-资源」栏的 Wails 服务。
  6. * @module
  7. */
  8. // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  9. // @ts-ignore: Unused imports
  10. import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
  11. // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  12. // @ts-ignore: Unused imports
  13. import * as $models from "./models.js";
  14. /**
  15. * CancelDownload 取消进行中的下载。
  16. * @param {string} name
  17. * @returns {$CancellablePromise<void>}
  18. */
  19. export function CancelDownload(name) {
  20. return $Call.ByID(3403882890, name);
  21. }
  22. /**
  23. * DownloadResource 下载并安装指定资源(同步执行,进度经事件上报,可被 CancelDownload 取消)。
  24. * useMirror=true 强制从资源站镜像下载;默认优先主地址(GitHub),无主地址时自动改用镜像。
  25. * @param {string} name
  26. * @param {boolean} useMirror
  27. * @returns {$CancellablePromise<void>}
  28. */
  29. export function DownloadResource(name, useMirror) {
  30. return $Call.ByID(1400169156, name, useMirror);
  31. }
  32. /**
  33. * GetResourceStatus 查询单个资源安装状态。
  34. * @param {string} name
  35. * @returns {$CancellablePromise<$models.ResourceStatus>}
  36. */
  37. export function GetResourceStatus(name) {
  38. return $Call.ByID(2905325282, name).then(/** @type {($result: any) => any} */(($result) => {
  39. return $$createType0($result);
  40. }));
  41. }
  42. /**
  43. * ListResources 返回资源列表(含本机安装状态)。
  44. * 优先使用用户配置的服务器清单;失败或未配置时回退内置默认清单。
  45. * 服务器拉取失败时通过 resources:listerror 事件告知前端(不再静默回退)。
  46. * @returns {$CancellablePromise<$models.ResourceStatus[]>}
  47. */
  48. export function ListResources() {
  49. return $Call.ByID(3235964749).then(/** @type {($result: any) => any} */(($result) => {
  50. return $$createType1($result);
  51. }));
  52. }
  53. /**
  54. * RemoveResource 删除已安装资源:仅移除安装目录/文件,不修改用户 PATH 环境变量。
  55. * @param {string} name
  56. * @returns {$CancellablePromise<void>}
  57. */
  58. export function RemoveResource(name) {
  59. return $Call.ByID(3574422060, name);
  60. }
  61. // Private type creation functions
  62. const $$createType0 = $models.ResourceStatus.createFrom;
  63. const $$createType1 = $Create.Array($$createType0);