UNPKG

@overwolf/types

Version:

Type definition file for autocompletion and documentation purposes

1,746 lines (1,543 loc) 200 kB
declare namespace overwolf { const version: string; enum ResultStatusTypes { Success = "success", Error = "error", } interface Result { /** * Whether the method executed successfully or not. */ success: boolean; /** * Information regarding the error (if an error occurred) */ error?: string; } interface Event<T> { /** * Registers a listener to an event. When the event occurs, all registered * listeners are called. * @param callback The callback function to call when the event occurs. */ addListener(callback: (event: T) => void): void; /** * Unregister a listener to an event. * @param callback The callback should be the same function that was passed * to addListener(). If an anonymous function was passed, it cannot be * removed. */ removeListener(callback: (event: T) => void): void; } interface Dictionary<T> { [key: string]: T; } type CallbackFunction<T extends Result> = (result: T) => void; type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]>; }; } declare namespace overwolf.io { namespace enums { const enum eEncoding { UTF8 = "UTF8", UTF8BOM = "UTF8BOM", Unicode = "Unicode", UnicodeBOM = "UnicodeBOM", ASCII = "ASCII", } const enum encoding { Default = "Default", UTF8 = "UTF8", UTF32 = "UTF32", Unicode = "Unicode", UTF7 = "UTF7", ASCII = "ASCII", BigEndianUnicode = "BigEndianUnicode", } const enum WatchEventType { Registered = "Registered", Changed = "Changged", Renamed = "Renamed", Deleted = "Deleted" } } namespace paths { const programFiles: string; const programFilesX86: string; const commonFiles: string; const commonFilesX86: string; const commonAppData: string; const desktop: string; const windows: string; const system: string; const systemX86: string; const documents: string; const videos: string; const pictures: string; const music: string; const commonDocuments: string; const favorites: string; const fonts: string; const startMenu: string; const localAppData: string; const overwolfInstallation: string; const overwolfInstallationWithVersion: string; const obsBin: string; } interface ReadFileOptions { encoding: enums.eEncoding; maxBytesToRead: number; offset: number; } interface ListenFileOptions { skipToEnd: boolean; encoding?: enums.eEncoding; } interface FileExistsResult extends Result { found?: boolean; } interface ExistsResult extends Result { exist?: boolean; } interface ReadFileContentsResult extends Result { status: string; content?: string; } interface DirResult extends Result { data?: FileInDir[]; } interface FileInDir { name: string; type: 'dir' | 'file'; } interface ReadBinaryFileResult extends Result { content: ArrayBuffer | null; length: number; } interface ReadTextFileResult extends Result { content?: string; info?: FileInfo; } interface ListenOnFileResult extends Result { content?: string; } interface WatchedFileChanged extends Result { eventType?: enums.WatchEventType, path?: string, newPath?: string } interface FileInfo { eof: boolean; totalRead: number; position: number; totalLines: number; } /** * Checks for the existence of the file in the given path. * @param filePath The path to check for. * @param callback Returns with the result. */ function fileExists( filePath: string, callback: CallbackFunction<FileExistsResult> ): void; /** * Writes the content to the target file. If the file doesn't exist, it will * be created, along with any needed directories along the path. Otherwise, * the file's content will be overwritten. * @param filePath The full path of the file to write to. * @param content The content to write. * @param encoding The encoding to use, see more at * @param triggerUacIfRequired If additional permissions are required, allows * the triggering of the Windows UAC dialog. * @param callback Called with the status of the request. */ function writeFileContents( filePath: string, content: string, encoding: enums.eEncoding, triggerUacIfRequired: boolean, callback: CallbackFunction<Result> ): void; /** * Read the content to the target file. * @param filePath The full path of the file to write to. * @param encoding The encoding to use, see more at * @param callback Called with the status of the request and the file content. */ function readFileContents( filePath: string, encoding: enums.eEncoding, callback: CallbackFunction<ReadFileContentsResult> ): void; /** * Copy a file from the local extension directory to a destination on the * local machine. * @param src a relative (to the root of your extension's folder) file path or * a full overwolf-extension:// URI to the source file to be copied * @param dst The destination path (including filename) to copy to. * @param overrideFile true if you want an existing file to be overwritten, * false otherwise. * @param reserved for future use. * @param callback result callback. */ function copyFile( src: string, dst: string, overrideFile: boolean, reserved: boolean, callback: CallbackFunction<Result> ): void; /** * Lists all files and folder in the target path. * @param path The target path * @param callback result callback. */ function dir(path: string, callback: CallbackFunction<DirResult>): void; /** * Reads a file's contents and returns an array of byte values. * This function is extremely slow! Use it only for small files. * @param path The target path. * @param options Describes the different options to read a file. * @param callback result callback. */ function readBinaryFile( path: string, options: ReadFileOptions, callback: CallbackFunction<ReadBinaryFileResult> ): void; /** * Reads a file's contents and returns it as text. * @param path The target path. * @param options Describes the different options to read a file. * @param callback result callback. */ function readTextFile( path: string, options: ReadFileOptions, callback: CallbackFunction<ReadTextFileResult> ): void; /** * Is path exist. * @param path The target path. * @param callback result callback. */ function exist(path: string, callback: CallbackFunction<ExistsResult>): void; /** * Start listening on file. * Stream a file (text files only), line-by-line, from the local filesystem. * @param id listen Id. * @param path The target path. * @param options Describes the different options to listen to a file. * @param callback result callback. */ function listenOnFile( id: string, path: string, options: ListenFileOptions, callback: CallbackFunction<ListenOnFileResult> ): void; /** * Stop listening on file. * Stop streaming a file that you previously passed when calling listenOnFile(). * There are no callbacks - as this will never fail (even if the stream doesn't exist). * @param id listen Id. */ function stopFileListener(id: string): void; function watchFile( filePath: string, callback: CallbackFunction<WatchedFileChanged> ): void; function stopWatchingFile( path: string, callback: CallbackFunction<Result> ): void; } declare namespace overwolf.cryptography { interface EncryptedDataResult extends Result { ciphertext: string; } interface DecryptedDataResult extends Result { plaintext: string; } /** * Encrypt provided plaintext for current system user * @param plaintext Text to encrypt * @param callback Will be called with encrypted ciphertext */ function encryptForCurrentUser( plaintext: string, callback: CallbackFunction<EncryptedDataResult> ): void; /** * Decrypt provided ciphertext for current system user * @param ciphertext Text to decrypt * @param callback Will be called with decrypted plaintext */ function decryptForCurrentUser( ciphertext: string, callback: CallbackFunction<DecryptedDataResult> ): void; } declare namespace overwolf.media { namespace enums { /** * Media type for the Media Event. */ const enum eMediaType { Video = "Video", Image = "Image", } const enum eSourceType { Webcam = "Webcam" } const enum eVideoSourceTransform { Stretch = "Stretch" } } interface RescaleParams { width: number; height: number; } interface CropParams { x: number; y: number; width: number; height: number; } interface MemoryScreenshotParams { roundAwayFromZero?: boolean; rescale?: RescaleParams; crop?: CropParams; } interface FileResult extends Result { url?: string; path?: string; } interface GetAppVideoCaptureFolderSizeResult extends Result { totalVideosSizeMB?: number; } interface GetAppScreenCaptureFolderSizeResult extends Result { screenCaptureSizeMB?: number; } interface ScreenshotTakenEvent { url: string; } interface Webcam { name: string; path: string; id: string; } interface GetWebcamsResult extends Result { webCams?: Webcam[]; } /** * Takes a screenshot and calls the callback with the success status and the * screenshot URL. The screenshot is saved to the screenshots folder. * @param callback A function called after the screenshot was taken. */ function takeScreenshot(callback: CallbackFunction<FileResult>): void; /** * Get all connected Webcams. * @param callback A callback function which will be called with the status of the request. */ function GetWebcams(callback: CallbackFunction<GetWebcamsResult>): void; /** * Takes a screenshot and calls the callback with the success status and the * screenshot URL. The screenshot is saved to the screenshots folder. * @param targetFolder Target screen shot folder path. * @param callback A function called after the screenshot was taken. */ function takeScreenshot( targetFolder: string, callback: CallbackFunction<FileResult> ): void; /** * Takes a window screenshot and calls the callback with the success status * and the screenshot URL. The screenshot is saved to the screenshots folder. * @param windowHandle The window Name * @param postMediaEvent set true to post media event (onMediaEvent) * @param targetFolder set target folder path to screen shot * @param callback A function called after the screenshot was taken. */ function takeWindowsScreenshotByHandle( windowHandle: number, postMediaEvent: boolean, targetFolder: string, callback: CallbackFunction<FileResult> ): void; /** * Takes a window screenshot and calls the callback with the success status * and the screenshot URL. The screenshot is saved to the screenshots folder. * @param windowHandle The window Name * @param postMediaEvent set true to post media event (onMediaEvent) * @param callback A function called after the screenshot was taken. */ function takeWindowsScreenshotByHandle( windowHandle: number, postMediaEvent: boolean, callback: CallbackFunction<FileResult> ): void; /** * Takes a window screenshot and calls the callback with the success status * and the screenshot URL. The screenshot is saved to the screenshots folder. * @param windowName The window Name * @param postMediaEvent set true to post media event (onMediaEvent) * @param targetFolder set target folder path to screen shot * @param callback A function called after the screenshot was taken. */ function takeWindowsScreenshotByName( windowName: string, postMediaEvent: boolean, targetFolder: string, callback: CallbackFunction<FileResult> ): void; /** * Takes a window screenshot and calls the callback with the success status * and the screenshot URL. The screenshot is saved to the screenshots folder. * @param windowName The window Name * @param postMediaEvent set true to post media event (onMediaEvent) * @param callback A function called after the screenshot was taken. */ function takeWindowsScreenshotByName( windowName: string, postMediaEvent: boolean, callback: CallbackFunction<FileResult> ): void; /** * Takes a memory screenshot and calls the callback with the success status * and the screenshot URL. The screenshot will only be placed in the memory * and will not be saved to a file (better performance). Can only be used * while in a game. * @param screenshotParams A JSON containing the parameters of the screenshot. * @param callback A function called after the screenshot was taken. */ function getScreenshotUrl( screenshotParams: MemoryScreenshotParams, callback: CallbackFunction<FileResult> ): void; /** * Opens the social network sharing console to allow the user to share a * picture. * @param image A URL or image object to be shared. * @param description The description to be used when posting to social * networks. * @param callback A function called after the image was shared. */ function shareImage( image: any, description: string, callback: CallbackFunction<Result> ): void; /** * Posts a media event for other apps to receive. The time info should be * received in UTC format. * @param mediaType The type of the event. * @param jsonInfo A json with additional info about the event. * @param callback A callback with the status if the call. */ function postMediaEvent( mediaType: enums.eMediaType, jsonInfo: any, callback: CallbackFunction<Result> ): void; /** * Returns the total size of the video capture folder created by the app. This * includes all video/thumbnail and other files that are under the apps video * folder - which is located inside the configured Overwolf video capture * folder. NOTE: this function can take a long time to return if the folder * contains a large amount of files (on some computers) - therefore,try to * reduce the amount of times you call it. * @param callback A callback with the size in MB. */ function getAppVideoCaptureFolderSize( callback: CallbackFunction<GetAppVideoCaptureFolderSizeResult> ): void; /** * Similar to |getAppVideoCaptureFolderSize| but looks at the apps screen * capture folder. * @param callback A callback with the size in MB. */ function getAppScreenCaptureFolderSize( callback: CallbackFunction<GetAppScreenCaptureFolderSizeResult> ): void; /** * Fired when a media event has been posted. */ const onMediaEvent: Event<any>; /** * Fired when a screenshot was taken. */ const onScreenshotTaken: Event<ScreenshotTakenEvent>; } declare namespace overwolf.media.videos { namespace enums { const enum WatermarkLocation { BottomCenter = "BottomCenter", BottomLeft = "BottomLeft", BottomRight = "BottomRight", Center = "Center", MidLeft = "MidLeft", MidRight = "MidRight", TopCenter = "TopCenter", TopLeft = "TopLeft", TopRight = "TopRight", } } interface VideoCompositionSegment { startTime: number; endTime: number; } /** * A helper structure to describe watermark parameters. * @param startTime Segment start time (in milliseconds) * @param endTime Segment end time (in milliseconds) * @param location The location of the watermark * @param scaleHeight The height of the watermark image (in pixel) * */ interface WatermarkParams { startTime?: number; endTime?: number; location?: enums.WatermarkLocation; scaleHeight?: number; } interface GetVideosResult extends Result { videos?: string[]; } interface GetVideosSizeResult extends Result { totalSizeGbs?: number; } /** * Creates a compilation video out of a source video and a list of segments. * @param sourceVideoUrl The url of the source video in an overwolf://media * form. * @param segments A JSON containing a list of segments, each segment has a * start time and an end time in milliseconds. The segments must be sorted in * ascending order. Example: * { * "segments": [ * { "startTime": 2000, "endTime": 4000 }, * { "startTime": 8000, "endTime": 10000 }, * { "startTime": 14000, "endTime": 18000 } * ] * } * @param callback A callback function which will be called with the status of * the request and the url to the target video. */ function createVideoComposition( sourceVideoUrl: string, segments: { segments: VideoCompositionSegment[]; }, callback: CallbackFunction<FileResult> ): void; /** * Creates a compilation video out of a source video and a list of segments. * @param files list of files to composite to output video file * (overwolf://media form. or file:///) * @param outputFile the file output name * @param callback A callback function which will be called with the status of * the request and the url to the target video. */ function createVideoCompositionFiles( files: string[], outputFile: string, callback: CallbackFunction<FileResult> ): void; /** * Gets a list of all of the videos created by this app. * @param callback A callback function which will be called with the status of * the request. */ function getVideos(callback: CallbackFunction<GetVideosResult>): void; /** * Returns the total size of the video files created by this app in gigabytes. * @param callback A callback with the videos size. */ function getVideosSize(callback: CallbackFunction<GetVideosSizeResult>): void; /** * Deletes all videos created by this app with an option to keep the newest X * GBs (use with care). * @param keepNewestXGbs Keep the newest X GBs of videos. Pass 0 to delete all * videos. * @param callback A callback function which will be called with the status of * the request. */ function deleteOldVideos( keepNewestXGbs: number, callback: CallbackFunction<Result> ): void; /** * Deletes a specific video created by this app. * @param videoUrl The Overwolf URL of the video to delete. * @param callback A callback function which will be called with the status of * the request. */ function deleteVideo( videoUrl: string, callback: CallbackFunction<Result> ): void; /** * Adds a video/image watermark to a video. * @param sourceVideoUrl The url of the source video in an overwolf://media form. * @param watermarkUrl The url of the watermark video/image in an overwolf://media form. * @param watermarkParams Use this object to mark the watermark * @param callback A callback function which will be called with the status of * the request and the url to the output video. */ function addWatermark( sourceVideoUrl: string, watermarkUrl: string, watermarkParams: WatermarkParams, callback: CallbackFunction<FileResult> ): void; } declare namespace overwolf.media.replays { namespace enums { const enum ReplayType { Video = "Video" } } interface WebCamParam { device_id: string; } /** * Defines the video source settings. */ interface VideoSource { source_type: overwolf.media.enums.eSourceType; name: string; secondary_file: boolean; // Source will be saved to a secondary video file (i.e another ow-obs.exe process will be created with the same settings as the original one. transform: overwolf.media.enums.eVideoSourceTransform; parameters: overwolf.media.replays.WebCamParam; position: { x: number, y: number } size_scale: { x: number, y: number } } /** * Replays settings container. */ interface ReplaySettings extends streaming.StreamSettings { /** * Auto highlights configuration. */ highlights?: ReplayHighlightsSetting; } /** * Auto highlights settings. */ interface ReplayHighlightsSetting { /** * Enable auto Highlights recording. */ enable: boolean; /** * Array of requested highlights. * use ["*"] to register all features. */ requiredHighlights: string[]; } interface TurnOffResult extends Result { description?: string; metadata?: string; osVersion?: string; osBuild?: string; } interface TurnOnResult extends Result { description?: string; metadata?: string; mediaFolder?: string; osVersion?: string; osBuild?: string; } interface GetHighlightsFeaturesResult extends Result { features?: string[]; } interface GetStateResult extends Result { isOn?: boolean; } interface ReplayResult extends Result { url?: string; path?: string; encodedPath?: string; duration?: number; thumbnail_url?: string; thumbnail_path?: string; thumbnail_encoded_path?: string; start_time?: number; } interface StartReplayResult extends streaming.StartCaptureResult { status: string // backwards compatibility description: string; metadata: string; mediaFolder: string; osVersion: string; osBuild: string; isGameWindowCapture: boolean; } interface CaptureErrorEvent { status: string; stream_id: number; error: string; } interface CaptureStoppedEvent { status: string; reason: string; metaData: string; osVersion: string; osBuild: string; } interface CaptureWarningEvent { warning: string; reason: string; } interface ReplayServicesStartedEvent { extensions: string[]; is_game_window_capture?: boolean; } interface HighlightsCapturedEvent { game_id: number; match_id: string; match_internal_id: string; session_id: string; session_start_time: number; match_start_time: number; start_time: number; duration: number; events: string[]; raw_events: raw_events[]; media_url: string; media_path: string; media_path_encoded: string; thumbnail_url: string; thumbnail_path: string; thumbnail_encoded_path: string; replay_video_start_time: number; } interface raw_events { type: string; time: number; } /** * Turns off background replay capturing. Call this as soon as you no longer * interesting in capturing, in order to free up resources. * @param callback A callback function which will be called with the status of * the request. */ function turnOff(callback: CallbackFunction<TurnOffResult>): void; /** * Turns on background replay capturing. Without calling it first, you will * not be able to create video replays. Notice that turning on replay * capturing will consume system resources so use it wisely.buffer_length * defines the amount of time in milliseconds to have captured in the memory * at all times. * @param settings The video capture settings. * @param callback A callback function which will be called with the status of * the request. */ function turnOn( settings: ReplaySettings, callback: CallbackFunction<TurnOnResult> ): void; /** * Returns whether replay capturing is turned on or off. * @param callback A callback function which will be called with the status of * the request. */ function getState(callback: CallbackFunction<GetStateResult>): void; /** * Returns whether replay capturing is turned on or off. * @deprecated Since version 0.155. * @param replayType The type of replay to get state for. * @param callback A callback function which will be called with the status of * the request. */ function getState( replayType: replays.enums.ReplayType, callback: CallbackFunction<GetStateResult> ): void; /** * Starts capturing a replay to a file. A replay id will be returned in the * callback which is needed to finish capturing the replay. You can only call * this method if replay mode is on and no other replay is currently being * captured to a file. * @param pastDuration The replay length, in milliseconds to include prior to * the time of this call. * @param futureDuration The replay lengh, in milliseconds to include after * the time of this call. To ignore it, simply give it a non-positive value * @param captureFinishedCallback A callback function which will be called * when capturing is finished, at the end of the future duration supplied to * this call. * @param callback A callback function which will be called with the status of * the request. */ function capture( pastDuration: number, futureDuration: number, captureFinishedCallback: CallbackFunction<ReplayResult>, callback: CallbackFunction<StartReplayResult> ): void; /** * Starts capturing a replay to a file. A replay id will be returned in the * callback which is needed to finish capturing the replay. You can only call * this method if replay mode is on and no other replay is currently being * captured to a file. * @deprecated Since version 0.155. * @param replayType The type of replay to capture. * @param pastDuration The replay length, in milliseconds to include prior to * the time of this call. * @param futureDuration The replay length, in milliseconds to include after * the time of this call. To ignore it, simply give it a non-positive value * @param captureFinishedCallback A callback function which will be called * when capturing is finished, at the end of the future duration supplied to * this call. * @param callback A callback function which will be called with the status of * the request. */ function capture( replayType: replays.enums.ReplayType, pastDuration: number, futureDuration: number, captureFinishedCallback: CallbackFunction<ReplayResult>, callback: CallbackFunction<Result> ): void; /** * Starts capturing a replay to a file. A replay id will be returned in the * callback which is needed to finish capturing the replay. You can only call * this method if replay mode is on and no other replay is currently being * captured to a file. * @param pastDuration The video length, in milliseconds to include prior to * the time of this call. * @param callback A callback function which will be called with the status of * the request. */ function startCapture( pastDuration: number, callback: CallbackFunction<FileResult> ): void; /** * Starts capturing a replay to a file. A replay id will be returned in the * callback which is needed to finish capturing the replay. You can only call * this method if replay mode is on and no other replay is currently being * captured to a file. * @deprecated Since version 0.155. * @param replayType The type of replay to capture. * @param pastDuration The video length, in milliseconds to include prior to * the time of this call. * @param callback A callback function which will be called with the status of * the request. */ function startCapture( replayType: replays.enums.ReplayType, pastDuration: number, callback: CallbackFunction<FileResult> ): void; /** * Finishes capturing a replay and returns a url to the created video file. * You can only call this method if replay mode is on and using a valid id of * a replay being captured to a file. * @param replayId The id of the replay you want to finish capturing. * @param callback A callback function which will be called with the status of * the request. */ function stopCapture( replayId: string, callback: CallbackFunction<ReplayResult> ): void; /** * Finishes capturing a replay and returns a url to the created video file. * You can only call this method if replay mode is on and using a valid id of * a replay being captured to a file. * @deprecated Since version 0.155. * @param replayType The type of replay to stop capture. * @param replayId The id of the replay you want to finish capturing. * @param callback A callback function which will be called with the status of * the request. */ function stopCapture( replayType: replays.enums.ReplayType, replayId: string, callback: CallbackFunction<FileResult> ): void; /** * change target sub folder of current running replay provider * @param replayType The type of replay to stop capture. * @param subFolderName the new sub folder name * @param callback A callback function which will be called with the status of * the request. */ function setReplaysSubFolder( replayType: replays.enums.ReplayType, subFolderName: string, callback: CallbackFunction<Result> ): void; /** * Get supported auto highlights features for a game * @param gameId The id of the game you want to capture it highlights. * @param callback A callback function which will be called with the status of * the request. */ function getHighlightsFeatures( gameId: number, callback: CallbackFunction<GetHighlightsFeaturesResult> ): void; /** * Fired when an error has occurred with the capturing. */ const onCaptureError: Event<CaptureErrorEvent>; /** * Fired when replay service is stopped. */ const onCaptureStopped: Event<CaptureStoppedEvent>; /** * Fired on capture service warning. */ const onCaptureWarning: Event<CaptureWarningEvent>; /** * Fired when the replay service is on (any other app); */ const onReplayServicesStarted: Event<ReplayServicesStartedEvent>; /** * Fired when a new Replay highlight recorded (when highlightsSetting is enabled). */ const onHighlightsCaptured: Event<HighlightsCapturedEvent>; } declare namespace overwolf.notifications { namespace enums { const enum AppLogoCrop { Default = "Default", None = "None", Circle = "Circle", } const enum ToatsEventType { Dismiss = "dismiss", ButtonClick = "buttonClick", Error = "error", } const enum ToastEventError { Unknown = "unknown", NotificationsDisabled = "notificationsDisabled ", Error = "error" } } interface ToastNotificationParams { header?: string; /** * Mandatory. Must include 1-3 texts (lines). */ texts: string[]; /** * By default, your toast will display your app's logo. However, you can override this logo with your own image. */ logoOverride?: LogoOverride; /** * Toasts can display a hero image, which is displayed prominently within the toast banner and while inside Action Center. Image dimensions must be 364x180 pixels. */ heroImage?: string; /** * You can provide a full-width inline-image that appears when you expand the toast. */ inlineImage?: string; /** * If you need to reference the source of your content, you can use attribution text. This text is always displayed at the bottom of your notification, along with your app's identity or the notification's timestamp. */ attribution?: string; /** * Buttons make your toast interactive, letting the user take quick actions on your toast notification without interrupting their current workflow. Buttons appear in the expanded portion of your notification. */ buttons?: ToastNotificationButton[]; } interface LogoOverride { url: string; cropType: enums.AppLogoCrop; } interface ToastNotificationButton { id: string; text: string; } interface ShowToastNotificationResult extends Result { id: string; } interface ToastNotificationEvent { id: string; eventType: enums.ToatsEventType; buttonID: string; error: string; errorCode: enums.ToastEventError; } /** * Fired when a user tapped on the body of a toast notification or performed an action inside a toast notification. */ const onToastInteraction: Event<ToastNotificationEvent>; /** * Show Windows toast notification. * @param args Toast notification params * @param callback A function called with the current user, or an error. */ function showToastNotification( args: ToastNotificationParams, callback: CallbackFunction<ShowToastNotificationResult> ): void; } declare namespace overwolf.profile { const enum ConnectionState { Unknown = "Unknown", Offline = "Offline", Connecting = "Connecting", Online = "Online", Disconnecting = "Disconnecting", } interface GetCurrentUserResult extends Result { avatar?: string; channel?: string; machineId?: string; partnerId?: number; userId?: string; username?: string; parameters?: Dictionary<string>; installParams?: any; installerExtension?: any; displayName?: string; uuid?: string; } interface LoginStateChangedEvent { status: string; connectionState: ConnectionState; username: string; } interface GenerateUserSessionTokenResult extends Result { token: string; } /** * Calls the given callback with the currently logged-in Overwolf user. * @param callback A function called with the current user, or an error. */ function getCurrentUser( callback: CallbackFunction<GetCurrentUserResult> ): void; /** * Opens the login dialog. */ function openLoginDialog(): void; /** * Fetches user profile from server, then invokes the callback with the currently logged-in Overwolf user. * @param callback A function called with the current user, or an error. */ function refreshUserProfile( callback: CallbackFunction<GetCurrentUserResult> ): void; function generateUserSessionToken( callback: CallbackFunction<GenerateUserSessionTokenResult> ): void; function performOverwolfSessionLogin( token: string, callback: CallbackFunction<Result> ): void /** * Fired when a user logged in or logged out. */ const onLoginStateChanged: Event<LoginStateChangedEvent>; } declare namespace overwolf.profile.subscriptions.inapp { const enum Theme { Light = "Light", Dark = "Dark", } /** * Shows the in-app subscription page as a modal window on top of the current window. * @param planId The plan Id to display. * @param theme Optional. "Dark" or "Light. If not defined, the default is light. * @param callback A callback function which will be called with the status of the request. */ function show( planId: number, theme: string, ): void; /** * Hide the current active in-app subscription modal window. * @param callback A callback function which will be called with the status of the request. */ function hide( callback: CallbackFunction<Result> ): void; /** * Fired when a subscription in-app modal window is opened. */ const onInAppSubModalOpened: Event<any>; /** * Fired when a subscription in-app modal window is closed. */ const onInAppSubModalClosed: Event<any>; } declare namespace overwolf.profile.subscriptions { namespace enums { const enum SubscriptionState { Active = "active", Cancelled = "cancelled", Revoked = "revoked", } } interface Info { title: string; description: string; periodMonths: number; price: number; } interface Subscription { id: number; pid: number; uid: string; extid: string; muid: string; exp: number; grc: number; state: overwolf.profile.subscriptions.enums.SubscriptionState; planInfo: Info; expired: boolean; } interface GetActivePlansResult extends Result { plans?: number[]; } interface GetDetailedActivePlansResult extends Result { plans?: Plan[]; } interface Plan { planId: number; state: overwolf.profile.subscriptions.enums.SubscriptionState; expiryDate: number; title: string; description: string; price: number; periodMonths: number; } interface SubscriptionChangedEvent { plans?: number[]; } /** * Returns active subscriptions for the calling extension via callback. * @param callback Returns an array of plan IDs, or an error. */ function getActivePlans( callback: CallbackFunction<GetActivePlansResult> ): void; /** * Returns more details about all the active subscriptions for the calling extension via callback. * @param callback Returns an array of active plans, or an error. */ function getDetailedActivePlans( callback: CallbackFunction<GetDetailedActivePlansResult> ): void; /** * Fired when current extension subscription has changed. */ const onSubscriptionChanged: Event<SubscriptionChangedEvent>; } declare namespace overwolf.windows { namespace enums { const enum WindowStyle { InputPassThrough = "InputPassThrough", BottomMost = "BottomMost" } const enum WindowDragEdge { None = "None", Left = "Left", Right = "Right", Top = "Top", Bottom = "Bottom", TopLeft = "TopLeft", TopRight = "TopRight", BottomLeft = "BottomLeft", BottomRight = "BottomRight", } const enum MessagePromptIcon { None = "None", QuestionMark = "QuestionMark", ExclamationMark = "ExclamationMark", } const enum FlashBehavior { automatic = "automatic", on = "on", off = "off", } const enum WindowStateEx { closed = "closed", hidden = "hidden", maximized = "maximized", minimized = "minimized", normal = "normal" } const enum WindowType { Desktop = "Desktop", Background = "Background", OffScreen = " OffScreen" } } interface WindowInfo { name: string; id: string; state: string; stateEx: enums.WindowStateEx; isVisible: boolean; left: number; top: number; width: number; height: number; monitorId: string; } interface WindowProperties { nativeWindow: boolean; enablePopupBlocker: boolean; } interface DefaultSizeAndLocation { useDefaultSizeAndLocation: boolean; } interface ODKRect { top: number; left: number; width: number; height: number; } interface SetWindowPositionProperties { relativeTo: { processName: string; windowTitle: string; }; insertAbove: boolean; } interface MessageBoxParams { message_title: string; message_body: string; confirm_button_text: string; cancel_button_text: string; message_box_icon: windows.enums.MessagePromptIcon; } interface WindowResult extends Result { window: WindowInfo; } interface DragResizeResult extends Result { id?: string; width?: number; height?: number; } interface WindowIdResult extends Result { window_id?: string; } interface DragMovedResult extends Result { HorizontalChange: number; VerticalChange: number; } interface GetWindowStateResult extends Result { window_id?: string; window_state?: string; window_state_ex?: enums.WindowStateEx; } interface GetWindowsStatesResult extends Result { result: Dictionary<string>; resultV2: Dictionary<enums.WindowStateEx>; } interface IsMutedResult extends Result { muted: boolean; } interface IsWindowVisibleToUserResult extends Result { visible: "hidden" | "full" | "partial"; } interface IsAccelreatedOSRResult extends WindowIdResult { accelerated?: boolean; supported?: boolean; optimized?: boolean; } interface ChangeWindowSizeParams { window_id: string; width: number; height: number; auto_dpi_resize?: boolean; } interface WindowStateChangedEvent { window_id: string; window_state: string; window_previous_state: string; window_state_ex: enums.WindowStateEx; window_previous_state_ex: enums.WindowStateEx; app_id: string; window_name: string; } interface MessageReceivedEvent { id: string; content: any; } interface IsolatedIframeProcessCrashedEvent { id: string; error: string; } interface AltF4BlockedEvent { id: string; } interface onScreenPropertyChangedEvent { id: string; name: string; monitor: utils.Display; } /** * Calls the given callback function with the current window object as a * parameter. * @param callback A callback function which will be called with the current * window object as a parameter. See */ function getCurrentWindow(callback: CallbackFunction<WindowResult>): void; /** * Creates or returns a window by the window name that was declared in the * manifest. * @param windowName The name of the window that was declared in the * data.windows section in the manifest. * @param overrideSetting Override manifest settings * @param callback A callback function which will be called with the requested * window as a parameter. See */ function obtainDeclaredWindow( windowName: string, overrideSetting: WindowProperties, callback: CallbackFunction<WindowResult> ): void; /** * Creates or returns a window by the window name that was declared in the * manifest. * @param windowName The name of the window that was declared in the * data.windows section in the manifest. * @param callback A callback function which will be called with the requested * window as a parameter. */ function obtainDeclaredWindow( windowName: string, callback: CallbackFunction<WindowResult> ): void; /** * Creates an instance of your window (the window’s name has to be declared * in the manifest.json) or returns a window by the window name. * @param windowName The name of the window that was declared in the * data.windows section in the manifest. * @param useDefaultSizeAndLocation Enable the manifest size and position * settings (default is false). * @param callback A callback function which will be called with the requested * window as a parameter. */ function obtainDeclaredWindow( windowName: string, useDefaultSizeAndLocation: DefaultSizeAndLocation, callback: CallbackFunction<WindowResult> ): void; /** * Returns WindowResult object for a specific open window. * @param windowName The name of the window that was declared in the data.windows section in the manifest * @param callback Callback will be invoked with the WindowResult object. */ function getWindow( windowName: string, callback: CallbackFunction<WindowResult> ): void; /** * Start dragging a window. * @param windowId The id or name of the window to drag. * @param callback A callback which is called when the drag is completed. */ function dragMove( windowId: string, callback?: CallbackFunction<DragMovedResult> ): void; /** * Start resizing the window from a specific edge or corner. * @param windowId The id or name of the window to resize. * @param edge The edge or corner from which to resize the window. */ function dragResize( windowId: string, edge: windows.enums.WindowDragEdge ): void; /** * Start resizing the window from a specific edge or corner. * @param windowId The id or name of the window to resize. * @param edge The edge or corner from which to resize the window. * @param contentRect The real content of the window (for the in-game drawing * resizing white area) */ function dragResize( windowId: string, edge: windows.enums.WindowDragEdge, contentRect: ODKRect ): void; /** * Start resizing the window from a specific edge or corner. * @param windowId The id or name of the window to resize. * @param edge The edge or corner from which to resize the window. * @param callback Will be called when the resizing process is completed. */ function dragResize( windowId: string, edge: windows.enums.WindowDragEdge, rect: ODKRect, callback: CallbackFunction<DragResizeResult> ): void; /** * Changes the window size to the new width and height, in pixels. * @param windowId The id or name of the window for which to change the size. * @param width The new window width in pixels. * @param height The new window height in pixels. * @param callback A callback which is called when the size change is * completed. */ function changeSize( windowId: string, width: number, height: number, callback?: CallbackFunction<Result> ): void; /** * Changes the window size to the new width and height, in pixels, including DPI scale when resizing. * @param changeSizeParams Container for the window settings. * @param callback A callback which is called when the size change is * completed. */ function changeSize( changeSizeParams: ChangeWindowSizeParams, callback?: CallbackFunction<Result> ): void; /** * Changes the window minimum size to the new width and height, in pixels. * @param windowId windowId The id or name of the window for which to change * the minimum size. * @param width The new window minimum width in pixels. * @param height The new window minimum height in pixels. * @param callback A callback which is called when the minimum size change is * completed. */ function setMinSize( windowId: string, width: number, height: number, callback?: CallbackFunction<Result> ): void; /** * Flashes a window. * @param windowId ID of the window to flash. * @param behavior Defines window flashing behavior. * @param callback A callback which is called when the minimum size change is * completed. */ function flash( windowId: string, behavior: windows.enums.FlashBehavior, callback?: CallbackFunction<Result> ): void; /** * Set window zoom level (0.0 for reset). * @param winzoomFactorowId The zoome factor. * @param windowId The window id, empty for current window. */ function setZoom( winzoomFactorowId: number, windowId: string ): void; /** * Changes the window position in pixels from the top left corner. * @param windowId The id or name of the window for which to change the * position. * @param left The new window position on the X axis in pixels from the left. * @param top The new window position on the Y axis in pixels from the top. * @param callback A callback which is called when the position change is * completed. */ function changePosition( windowId: string, left: number, top: number, callback?: CallbackFunction<WindowIdResult> ): void; /** * Closes the window. * @param windowId The id or name of the window to close. * @param callback Called after the window is closed. */ function close( windowId: string, callback?: CallbackFunction<WindowIdResult> ): void; /** * Minimizes the window. * @param windowId The id or name of the window to minimize. * @param callback Called after the window is minimized. */ function minimize( windowId: string, callback?: CallbackFunction<WindowIdResult> ): void; /** * Hides the window. * @param windowId The id or name of the window to hide. * @param callback Called after the window is hidden. */ function hide( windowId: string, callback?: CallbackFunction<WindowIdResult> ): void; /** * Maximizes the window. * @param windowId The id or name of the window to maximize. * @param callback Called after the window is maximized. */ function maximize( windowId: string, callback?: CallbackFunction<WindowIdResult> ): void; /** * Restores a minimized window. * @param windowId The id or name of the window to restore. * @param callback Called after the window is restored. */ function restore( windowId: string, callback?: CallbackFunction<WindowIdResult> ): void; /** * Returns the state of the window (normal/minimized/maximized/closed). * @param windowId The id or name of the window. * @param callback Called with the window state. */ function getWindowState( windowId: string, callback: CallbackFunction<GetWindowStateResult> ): void; /** * Returns the state of all windows owned by the app * (normal/minimized/maximized/closed). * @param callback Called with an array containing the states of the windows. */ function getWindowsStates( callback: CallbackFunction<GetWindowsStatesResult> ): void; /** * Sends a message to an open window. * @param windowId The id or name of the window to send the message to. * @param messageId A message id. * @param messageContent The content of the message. * @param callback Called with the status of the request */ function sendMessage( windowId: string, messageId: string, messageContent: any, callback: CallbackFunction<WindowIdResult> ): void; /** * Returns an array of all open windows as objects. The objects can be * manipulated like any other window. * @param callback A callback function which will be called with a map object * of (window-name, Window Object) items */ function getOpenWindows( callback: (windows: Dictionary<Window>) => void ): void; /** * Returns a window object of the index page. */ function getMainWindow(): Window; /** * Opens the options page specified in the manifest file. Does nothing if no * such page has been specified. * @param callback */ function openOptionsPage(callback: CallbackFunction<WindowIdResult>): void; /** * Add Wi