using System; using System.Collections.Generic; using System.Threading.Tasks; using ElectronNET.API.Entities; namespace ElectronNET.API.Interfaces { /// /// Enable apps to automatically update themselves. Based on electron-updater. /// public interface IAutoUpdater { /// /// Whether to automatically download an update when it is found. (Default is true) /// bool AutoDownload { get; set; } /// /// Whether to automatically install a downloaded update on app quit (if `QuitAndInstall` was not called before). /// /// Applicable only on Windows and Linux. /// bool AutoInstallOnAppQuit { get; set; } /// /// *GitHub provider only.* Whether to allow update to pre-release versions. /// Defaults to "true" if application version contains prerelease components (e.g. "0.12.1-alpha.1", here "alpha" is a prerelease component), otherwise "false". /// /// If "true", downgrade will be allowed("allowDowngrade" will be set to "true"). /// bool AllowPrerelease { get; set; } /// /// *GitHub provider only.* /// Get all release notes (from current version to latest), not just the latest (Default is false). /// bool FullChangelog { get; set; } /// /// Whether to allow version downgrade (when a user from the beta channel wants to go back to the stable channel). /// Taken in account only if channel differs (pre-release version component in terms of semantic versioning). /// Default is false. /// bool AllowDowngrade { get; set; } /// /// For test only. /// string UpdateConfigPath { get; } /// /// The current application version /// Task CurrentVersionAsync { get; } /// /// Get the update channel. Not applicable for GitHub. /// Doesn’t return channel from the update configuration, only if was previously set. /// string Channel { get; } /// /// Get the update channel. Not applicable for GitHub. /// Doesn’t return channel from the update configuration, only if was previously set. /// Task ChannelAsync { get; } /// /// The request headers. /// Task> RequestHeadersAsync { get; } /// /// The request headers. /// Dictionary RequestHeaders { set; } /// /// Emitted when there is an error while updating. /// event Action OnError; /// /// Emitted when checking if an update has started. /// event Action OnCheckingForUpdate; /// /// Emitted when there is an available update. /// The update is downloaded automatically if AutoDownload is true. /// event Action OnUpdateAvailable; /// /// Emitted when there is no available update. /// event Action OnUpdateNotAvailable; /// /// Emitted on download progress. /// event Action OnDownloadProgress; /// /// Emitted on download complete. /// event Action OnUpdateDownloaded; /// /// Asks the server whether there is an update. /// /// Task CheckForUpdatesAsync(); /// /// Asks the server whether there is an update. /// /// This will immediately download an update, then install when the app quits. /// /// Task CheckForUpdatesAndNotifyAsync(); /// /// Restarts the app and installs the update after it has been downloaded. /// It should only be called after `update-downloaded` has been emitted. /// /// Note: QuitAndInstall() will close all application windows first and only emit `before-quit` event on `app` after that. /// This is different from the normal quit event sequence. /// /// *windows-only* Runs the installer in silent mode. Defaults to `false`. /// Run the app after finish even on silent install. Not applicable for macOS. Ignored if `isSilent` is set to `false`. void QuitAndInstall(bool isSilent = false, bool isForceRunAfter = false); /// /// Start downloading update manually. You can use this method if "AutoDownload" option is set to "false". /// /// Path to downloaded file. Task DownloadUpdateAsync(); /// /// Feed URL. /// /// Feed URL. Task GetFeedURLAsync(); } }