models.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // @ts-check
  2. // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
  3. // This file is automatically generated. DO NOT EDIT
  4. // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  5. // @ts-ignore: Unused imports
  6. import { Create as $Create } from "@wailsio/runtime";
  7. /**
  8. * Device represents a peer device.
  9. */
  10. export class Device {
  11. /**
  12. * Creates a new Device instance.
  13. * @param {Partial<Device>} [$$source = {}] - The source object to create the Device.
  14. */
  15. constructor($$source = {}) {
  16. if (!("ip" in $$source)) {
  17. /**
  18. * @member
  19. * @type {string}
  20. */
  21. this["ip"] = "";
  22. }
  23. if (!("version" in $$source)) {
  24. /**
  25. * LocalSend protocol version
  26. * @member
  27. * @type {string}
  28. */
  29. this["version"] = "";
  30. }
  31. if (!("port" in $$source)) {
  32. /**
  33. * @member
  34. * @type {number}
  35. */
  36. this["port"] = 0;
  37. }
  38. if (!("alias" in $$source)) {
  39. /**
  40. * @member
  41. * @type {string}
  42. */
  43. this["alias"] = "";
  44. }
  45. if (!("protocol" in $$source)) {
  46. /**
  47. * @member
  48. * @type {ProtocolType}
  49. */
  50. this["protocol"] = ProtocolType.$zero;
  51. }
  52. if (!("fingerprint" in $$source)) {
  53. /**
  54. * @member
  55. * @type {string}
  56. */
  57. this["fingerprint"] = "";
  58. }
  59. if (!("deviceModel" in $$source)) {
  60. /**
  61. * nullable
  62. * @member
  63. * @type {string | null}
  64. */
  65. this["deviceModel"] = null;
  66. }
  67. if (!("deviceType" in $$source)) {
  68. /**
  69. * @member
  70. * @type {DeviceType}
  71. */
  72. this["deviceType"] = DeviceType.$zero;
  73. }
  74. if (!("download" in $$source)) {
  75. /**
  76. * Whether the device has download server running
  77. * @member
  78. * @type {boolean}
  79. */
  80. this["download"] = false;
  81. }
  82. if (!("lastSeen" in $$source)) {
  83. /**
  84. * @member
  85. * @type {Date}
  86. */
  87. this["lastSeen"] = new Date("0001-01-01T00:00:00.000Z");
  88. }
  89. if (!("available" in $$source)) {
  90. /**
  91. * @member
  92. * @type {boolean}
  93. */
  94. this["available"] = false;
  95. }
  96. Object.assign(this, $$source);
  97. }
  98. /**
  99. * Creates a new Device instance from a string or object.
  100. * @param {any} [$$source = {}]
  101. * @returns {Device}
  102. */
  103. static createFrom($$source = {}) {
  104. const $$createField9_0 = $Create.DateFromTime;
  105. let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
  106. if ("lastSeen" in $$parsedSource) {
  107. $$parsedSource["lastSeen"] = $$createField9_0($$parsedSource["lastSeen"]);
  108. }
  109. return new Device(/** @type {Partial<Device>} */($$parsedSource));
  110. }
  111. }
  112. /**
  113. * DeviceType defines the type of the device.
  114. * @readonly
  115. * @enum {string}
  116. */
  117. export const DeviceType = {
  118. /**
  119. * The Go zero value for the underlying type of the enum.
  120. */
  121. $zero: "",
  122. DeviceTypeMobile: "mobile",
  123. DeviceTypeDesktop: "desktop",
  124. DeviceTypeWeb: "web",
  125. DeviceTypeHeadless: "headless",
  126. DeviceTypeServer: "server",
  127. };
  128. /**
  129. * ProtocolType defines the protocol type.
  130. * @readonly
  131. * @enum {string}
  132. */
  133. export const ProtocolType = {
  134. /**
  135. * The Go zero value for the underlying type of the enum.
  136. */
  137. $zero: "",
  138. ProtocolTypeHTTP: "http",
  139. ProtocolTypeHTTPS: "https",
  140. };