Files
decky-frontend-lib/src/globals/steam-client/User.ts
Yao Chung Hu 131ab4cc11 feat(globals): Steam client reference (#92)
* change: Add SteamClient types

Steam Version:  1690583737
Steam Client Build Date:  Sat, Jul 29 02:44 UTC -08:00

* new: Document some SteamClient interfaces

Using the SDH discord server, GitHub and some personal findings, I tried to document as much SteamClient functions as I can.

* new: Document some SteamClient interfaces - part 2

* new: Document some SteamClient interfaces - part 3

* new: Document some SteamClient interfaces - part 4

* new: Document some SteamClient interfaces - part 5

* new: Document some SteamClient interfaces - part 6

* new: Document some SteamClient interfaces - part 7

* change: Update interfaces to Steam Version 1691097434

Steam Version:  1691097434
Steam Client Build Date:  Fri, Aug 4 04:54 UTC -08:00

* new: Document some SteamClient interfaces - part 8

* new: Document some SteamClient interfaces - part 9

* change: Update interfaces to Steam Version 1694466342

Steam Version:  1694466342
Steam Client Build Date:  Tue, Sep 12 04:59 UTC +08:00

* new: Document some SteamClient interfaces - part 10

* new: Document some SteamClient interfaces - part 11

* new: Document some SteamClient interfaces - part 12

* new: Document some SteamClient interfaces - part 13

* new: Document some SteamClient interfaces - part 14

* change: Update interfaces to Steam Version 1698260427

Steam Version:  1698260427
Steam Client Build Date:  Thu, Oct 26 2:40 AM UTC -08:00

* new: Document some SteamClient interfaces - part 10

* change: Update interfaces to Steam Version 1700160213

Steam Version:  1700160213
Steam Client Build Date:  Fri, Nov 17 2:23 AM UTC +08:00

* docs(SteamClient): document some interfaces

* change: Fix formatting style

* docs(SteamClient): document protobufs & System.Report

* docs(SteamClient): document CMsgMonitorInfo

* docs(SteamClient): document remaining messages

* docs(SteamClient): update interfaces to Steam Version 1702515219
Steam Version:  1702515219
Steam Client Build Date:  Thu, Dec 14 00:36 UTC -08:00

* docs(SteamClient): update interfaces to Steam Version 1704329464
Steam Version:  1704329464
Steam Client Build Date:  Thu, Jan 4 12:23 AM UTC -08:00

* docs(SteamClient): update interfaces to Steam Version 1705630720
Steam Version:  1705630720
Steam Client Build Date:  Fri, Jan 19 1:58 AM UTC -08:00

* docs(SteamClient): update interfaces to Steam Version 1706914901
Steam Version:  1706914901
Steam Client Build Date:  Fri, Feb 2 8:46 PM UTC -08:00

* docs(SteamClient): update interfaces to Steam Version 1709920887
Steam Version:  1709920887
Steam Client Build Date:  Thu, Mar 7 5:29 PM UTC -08:00

* docs(SteamClient): update interfaces to Steam Version 1710786209
Steam Version:  1710786209
Steam Client Build Date:  Mon, Mar 18 7:07 PM UTC -08:00

* docs(SteamClient): document even more interfaces

* new: Document some SteamClient interfaces - part 15

* Fix QAM button bit number

* new: Document some SteamClient interfaces - part 16

* change: Update interfaces to Steam Version 1714854927

Steam Version: 1714854927
Steam Client Build Date:  Sat, May 4 7:11 AM UTC -08:00

* change: Refactor and reorganize SteamClient

* docs(SteamClient): document more notification interfaces

* docs(SteamClient): document more interfaces

* docs(SteamClient): add some descriptions

* docs(SteamClient): remove duplicate types

* change: Fix rebase errors

* Updated ControllerStateChange

* Fix typo

* docs(SteamClient): update interfaces to Steam Version 1723601482

Steam Version:  1723601482
Steam Client Build Date:  Wed, Aug 14 01:51 UTC -08:00

* docs(SteamClient): update interfaces to 1725654351

* docs(SteamClient): update interfaces to 1730416762

* docs(SteamClient): forgot some stuff

* docs(SteamClient): add missed interfaces

* docs(SteamClient): update enums

* docs(SteamClient): add some things and move stuff around

* docs(SteamClient): move shared enums/interfaces to a separate file

* docs(SteamClient): add more stuff

* docs(SteamClient): reword some things

* docs(SteamClient): new BrowserView things

* docs(SteamClient): review fixes

* move to src/globals

---------

Co-authored-by: ricewind012 <58827198+ricewind012@users.noreply.github.com>
Co-authored-by: Party Wumpus <48649272+PartyWumpus@users.noreply.github.com>
Co-authored-by: Xander <xander@isxander.dev>
2025-04-23 11:20:48 -04:00

267 lines
6.9 KiB
TypeScript

import { EResult, OperationResponse, Unregisterable } from "./shared";
export interface User {
AuthorizeMicrotxn(txnId: number | string): void;
CancelLogin(): void;
CancelMicrotxn(txnId: number | string): void;
/**
* Tries to cancel Steam shutdown.
* @remarks Used in the "Shutting down" dialog.
*/
CancelShutdown(): void;
/**
* Opens the "Change Account" dialog.
*/
ChangeUser(): void;
Connect(): Promise<OperationResponse>;
FlipToLogin(): void;
/**
* Forces a shutdown while shutting down.
* @remarks Used in the "Shutting down" dialog.
*/
ForceShutdown(): void;
/**
* Forgets an account's password.
* @param accountName Login of the account to forget.
* @returns a boolean indicating whether the operation succeeded or not.
*/
ForgetPassword(accountName: string): Promise<boolean>;
/**
* Gets your country code.
* @returns a string containing your country code.
*/
GetIPCountry(): Promise<string>;
/**
* @todo param0 mirrors param3 of {@link RegisterForLoginStateChange}
*/
GetLoginProgress(callback: (param0: number, param1: number) => void): Unregisterable;
GetLoginUsers(): Promise<LoginUser[]>;
GoOffline(): void;
GoOnline(): void;
OptOutOfSurvey(): void;
PrepareForSystemSuspend(): Promise<{
result: EResult;
}>;
Reconnect(): void;
RegisterForConnectionAttemptsThrottled(callback: (data: ConnectionAttempt) => void): Unregisterable;
RegisterForCurrentUserChanges(callback: (user: CurrentUser) => void): void;
RegisterForLoginStateChange(
callback: (
/**
* Empty if not logged in.
*/
accountName: string,
state: ELoginState,
result: EResult,
param3: number,
percentage: number,
/**
* @todo name is from CLoginStore, but it's always empty, unused ?
*/
emailDomain: string,
) => void
): Unregisterable;
RegisterForPrepareForSystemSuspendProgress(callback: (progress: SuspendProgress) => void): Unregisterable;
RegisterForResumeSuspendedGamesProgress(callback: (progress: SuspendProgress) => void): Unregisterable;
RegisterForShowHardwareSurvey(callback: () => void): Unregisterable;
/**
* Register a function to be executed when shutdown completes.
* @param callback The function to be executed on completion.
*/
RegisterForShutdownDone(callback: (state: EShutdownStep, appid: number, param2: boolean) => void): Unregisterable;
RegisterForShutdownFailed(callback: (state: EShutdownStep, appid: number, success: boolean) => void): Unregisterable;
/**
* Register a function to be executed when Steam starts shutting down.
* @param callback The function to be executed on shutdown start.
*/
RegisterForShutdownStart(callback: (param0: boolean) => void): Unregisterable;
/**
* Register a function to be executed when shutdown state changes.
* @param callback The function to be executed on change.
*/
RegisterForShutdownState(callback: (state: EShutdownStep, appid: number, allowForceQuit: boolean) => void): Unregisterable;
/**
* Removes an account from remembered users.
* @param accountName The account to remove.
*/
RemoveUser(accountName: string): void;
RequestSupportSystemReport(reportId: string): Promise<{
bSuccess: boolean;
}>;
ResumeSuspendedGames(param0: boolean): Promise<ResumeSuspendedGamesResult>;
// Hardware survey information
RunSurvey(callback: (surveySections: SurveySection[]) => void): void;
SendSurvey(): void;
SetAsyncNotificationEnabled(appId: number, enable: boolean): void;
/**
* Sets given login credentials, but don't log in to that account.
* @param accountName Account name.
* @param password Account password.
* @param rememberMe Whether to remember that account.
*/
SetLoginCredentials(accountName: string, password: string, rememberMe: boolean): void;
SetOOBEComplete(): void;
ShouldShowUserChooser(): Promise<boolean>;
/**
* Signs out and restarts Steam.
*/
SignOutAndRestart(): void;
/**
* Relogin after disabling offline mode. Not sure what else it's useful for,
* there isn't even a single mention of it in steam's js, lol
*/
StartLogin(): void;
/**
* Toggles offline mode.
*
* Note that after disabling offline mode, you have to relogin with
* {@link StartLogin}.
*/
StartOffline(value: boolean): void;
/**
* Restarts the Steam client.
*
* @todo I don't remember what the arg is, but IIRC with `true` it disables
* some ldd check or whatever, really it's only noticeable on slow PCs.
*/
StartRestart(force: boolean): void;
/**
* @todo I don't remember what the arg is, but IIRC with `true` it disables
* some ldd check or whatever, really it's only noticeable on slow PCs.
*/
StartShutdown(force: boolean): void;
}
export interface ConnectionAttempt {
rtCooldownExpiration: number;
}
export interface CurrentUser {
NotificationCounts: {
async_game_updates: number;
comments: number;
gifts: number;
help_request_replies: number;
inventory_items: number;
invites: number;
moderator_messages: number;
offline_messages: number;
trade_offers: number;
};
bHWSurveyPending: boolean;
bIsLimited: boolean;
bIsOfflineMode: boolean;
bPromptToChangePassword: boolean;
bSupportAckOnlyMessages: boolean;
bSupportAlertActive: boolean;
bSupportPopupMessage: boolean;
clientinstanceid: string;
strAccountBalance: string;
strAccountBalancePending: string;
strAccountName: string;
strFamilyGroupID: string;
strSteamID: string;
}
export enum ELoginState {
None,
WelcomeDialog,
WaitingForCreateUser,
WaitingForCredentials,
WaitingForNetwork,
WaitingForServerResponse,
WaitingForLibraryReady,
Success,
Quit,
}
export enum EShutdownStep {
None,
Start,
WaitForGames,
WaitForCloud,
FinishingDownload,
WaitForDownload,
WaitForServiceApps,
WaitForLogOff,
Done,
// TODO: RegisterForShutdownDone outputs 9 here
}
export enum ESuspendResumeProgressState {
Invalid,
Complete,
CloudSync,
LoggingIn,
WaitingForApp,
Working,
}
export interface LoginUser {
personaName: string;
accountName: string;
hasPin: boolean;
rememberPassword: boolean;
avatarUrl: string;
}
export interface ResumeSuspendedGamesResult {
nAppIDPlayingElsewhere: number;
result: EResult;
}
export interface SuspendProgress {
bGameSuspended: boolean;
state: ESuspendResumeProgressState;
}
export interface SurveyEntry {
strName: string;
vecArgs: string[];
}
export interface SurveySection {
strSectionName: string;
vecEntries: SurveyEntry[];
}