@hagicode/steamworks.js 0.3.0 → 0.3.1-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.d.ts CHANGED
@@ -151,8 +151,76 @@ export declare namespace achievement {
151
151
  * @returns the icon, or `null` when it is still missing after the timeout (no icon is set, or Steam is slow). The two cases cannot be told apart.
152
152
  */
153
153
  export function loadIcon(achievement: string, timeoutMs?: number | undefined | null): Promise<AchievementIcon | null>
154
+ /** One entry of the global "most achieved" ranking, as returned by `getMostAchievedAchievements()`. */
155
+ export interface AchievementRank {
156
+ /** The achievement API name as configured in Steamworks. */
157
+ name: string
158
+ /** The global unlock percentage, from 0 to 100. */
159
+ percent: number
160
+ /** Whether the local user has unlocked the achievement. */
161
+ achieved: boolean
162
+ }
163
+ /**
164
+ * Returns the app's achievements ranked by global unlock percentage, in the order Steam lists them (most achieved first).
165
+ * Call `requestGlobalPercentages()` first. Returns an empty array while the percentages are not loaded or when the app has no achievements.
166
+ * @returns the ranking, one entry per achievement
167
+ */
168
+ export function getMostAchievedAchievements(): Array<AchievementRank>
154
169
  }
155
170
  export declare namespace apps {
171
+ /** The metadata of one DLC, as listed by `getDlcs()`. */
172
+ export interface DlcInfo {
173
+ /** The DLC's Steam app ID. */
174
+ appId: number
175
+ /** Steam's `available` flag for the DLC. The SDK header does not define it any further (unverified against a live Steam client). */
176
+ available: boolean
177
+ /** The DLC name as Steam reports it. */
178
+ name: string
179
+ }
180
+ /** The bytes of an optional DLC, as returned by `getDlcDownloadProgress()`. */
181
+ export interface DlcDownloadProgress {
182
+ /** The bytes downloaded so far. */
183
+ bytesDownloaded: bigint
184
+ /** The total bytes to download. */
185
+ bytesTotal: bigint
186
+ }
187
+ /** The size, SHA-1 hash and flags of a file, as returned by `getFileDetails()`. */
188
+ export interface FileDetails {
189
+ /** The original file size in bytes. */
190
+ size: bigint
191
+ /** The SHA-1 hash of the original file, as 40 lowercase hexadecimal characters. */
192
+ sha1: string
193
+ /** The flags as Steam reports them. The SDK header does not define them (unverified against a live Steam client). */
194
+ flags: number
195
+ }
196
+ /** The time limits of a timed trial, as returned by `getTimedTrial()`. */
197
+ export interface TimedTrial {
198
+ /** The playtime allowed, in seconds. */
199
+ secondsAllowed: number
200
+ /** The playtime used so far, in seconds. */
201
+ secondsPlayed: number
202
+ }
203
+ /** A beta branch of the app, as listed by `getBetas()`. */
204
+ export interface BetaBranch {
205
+ /** The branch name, for example `public` for the default branch. */
206
+ name: string
207
+ /** The branch description as Steam reports it. */
208
+ description: string
209
+ /** The build ID the branch currently has. */
210
+ buildId: number
211
+ /** The raw `EBetaBranchFlags` bit set: 1 default, 2 available, 4 private, 8 selected, 16 installed. */
212
+ flags: number
213
+ /** `true` for the default `public` branch. */
214
+ isDefault: boolean
215
+ /** `true` when the user can select the branch. */
216
+ isAvailable: boolean
217
+ /** `true` when the branch is password protected. */
218
+ isPrivate: boolean
219
+ /** `true` when the branch is the one selected for the user. */
220
+ isSelected: boolean
221
+ /** `true` when the branch is the one installed. */
222
+ isInstalled: boolean
223
+ }
156
224
  /**
157
225
  * Checks whether the user is subscribed to another app, such as a demo or a related game. Per the SDK docs, use it for ownership of an app related to yours, not as a general ownership check.
158
226
  * @param appId - The Steam app ID to check.
@@ -231,6 +299,82 @@ export declare namespace apps {
231
299
  export function launchCommandLine(): string
232
300
  /** @returns the value of a query parameter from the Steam launch link, or an empty string when there is none */
233
301
  export function launchQueryParam(key: string): string
302
+ /**
303
+ * Returns the Unix time (seconds since 1970-01-01 UTC) of the user's earliest purchase of the app. The SDK header does not say what is returned when the user has no purchase; unverified against a live Steam client.
304
+ * @param appId - the Steam app ID to look up
305
+ * @returns the Unix time, as an unsigned 32-bit integer
306
+ */
307
+ export function getEarliestPurchaseUnixTime(appId: number): number
308
+ /**
309
+ * Lists the DLC of the running app. Entries that the SDK does not return are left out, so the list can be shorter than the DLC count. Needs `init()`.
310
+ * @returns each DLC's app ID, availability flag and name, in the SDK's order
311
+ */
312
+ export function getDlcs(): Array<DlcInfo>
313
+ /**
314
+ * Starts installing an optional DLC. This changes the local installation: Steam starts downloading the DLC. Follow the progress with `getDlcDownloadProgress()`.
315
+ * @param appId - the DLC's Steam app ID
316
+ */
317
+ export function installDlc(appId: number): void
318
+ /**
319
+ * Uninstalls an optional DLC. This changes the local installation of the DLC. It does not change ownership.
320
+ * @param appId - the DLC's Steam app ID
321
+ */
322
+ export function uninstallDlc(appId: number): void
323
+ /**
324
+ * Tells Steam that the game files seem corrupt or missing. This changes the local installation: Steam acts on the report. What Steam then does is unverified against a live Steam client.
325
+ * @param missingFilesOnly - `true` to report only the missing files
326
+ * @returns the SDK's result as it is
327
+ */
328
+ export function markContentCorrupt(missingFilesOnly: boolean): boolean
329
+ /**
330
+ * Returns the depot IDs installed for the app, in mount order. At most 256 depots are read.
331
+ * @param appId - the Steam app ID
332
+ * @returns the depot IDs, or an empty array when none are reported
333
+ */
334
+ export function getInstalledDepots(appId: number): Array<number>
335
+ /**
336
+ * Returns the bytes downloaded and the total bytes of an optional DLC that is being installed.
337
+ * @param appId - the DLC's Steam app ID
338
+ * @returns the progress, or `null` when Steam reports none for the app
339
+ */
340
+ export function getDlcDownloadProgress(appId: number): DlcDownloadProgress | null
341
+ /**
342
+ * Reads the size, SHA-1 hash and flags of a file of the app. The request is answered while `runCallbacks()` runs. Needs `init()`.
343
+ * @param fileName - the file name to look up; a name with a NUL character is rejected
344
+ * @returns the file details; rejects when Steam reports an error or the answer is lost
345
+ */
346
+ export function getFileDetails(fileName: string): Promise<FileDetails>
347
+ /** @returns `true` when the user has the app through Family Sharing. Then `appOwner()` returns the lender, otherwise `false` */
348
+ export function isSubscribedFromFamilySharing(): boolean
349
+ /**
350
+ * Returns the time limits of the running app's timed trial. Needs `init()`.
351
+ * @returns the limits, or `null` when the app is not a timed trial
352
+ */
353
+ export function getTimedTrial(): TimedTrial | null
354
+ /**
355
+ * Tells Steam which DLC the user is playing, or none. Steam uses it to track the use of major DLC. Needs `init()`.
356
+ * @param appId - the DLC's Steam app ID, or `0` for none
357
+ * @returns the SDK's result as it is
358
+ */
359
+ export function setDlcContext(appId: number): boolean
360
+ /**
361
+ * Lists every beta branch of the app, including the default `public` branch. Needs `init()`.
362
+ * @returns the branches in the SDK's order; the array is empty when Steam reports none
363
+ */
364
+ export function getBetas(): Array<BetaBranch>
365
+ /**
366
+ * Selects a beta branch of the app; pass `public` to return to the default branch. This changes the local installation: Steam may need the game to restart before it updates to the new branch. Needs `init()`.
367
+ * @param name - the branch name, as `getBetas()` lists it
368
+ * @returns `true` when Steam accepted the branch, otherwise `false` (for example a name with a NUL character, or a name Steam refuses)
369
+ */
370
+ export function setActiveBeta(name: string): boolean
371
+ /**
372
+ * Requests the legacy proof-of-purchase (CD) key of the app or one of its DLC. The key arrives later in an `AppProofOfPurchaseKeyResponse` callback, which `callback.register` receives while `runCallbacks()` runs. The key is a secret: do not log it.
373
+ * @param appId - the Steam app ID of the app or DLC
374
+ */
375
+ export function requestProofOfPurchaseKey(appId: number): void
376
+ /** Requests every proof-of-purchase key of the app and its DLC. One `AppProofOfPurchaseKeyResponse` callback arrives per key, then a final one with `appId` `0` and an empty key. The keys are secrets: do not log them. */
377
+ export function requestAllProofOfPurchaseKeys(): void
234
378
  }
235
379
  export declare namespace auth {
236
380
  /**
@@ -251,6 +395,26 @@ export declare namespace auth {
251
395
  * @returns a Ticket holding the ticket bytes, readable with `getBytes()`.
252
396
  */
253
397
  export function getAuthTicketForWebApi(identity: string, timeoutSeconds?: number | undefined | null): Promise<Ticket>
398
+ /**
399
+ * Requests an encrypted app ticket for this app, with optional bytes encrypted into it. Needs `init()`. This sends a request to Steam.
400
+ * Resolves once Steam has the ticket; then read it with `getEncryptedAppTicket()`. Steam's answer is delivered through `runCallbacks()`, which `init()` already calls.
401
+ * Rejects when Steam reports an error, when `dataToInclude` is larger than 2^31 - 1 bytes (nothing is sent). There is no timeout: if Steam never answers, the Promise stays pending and the outcome is unknown.
402
+ * @param dataToInclude - optional bytes to encrypt into the ticket.
403
+ */
404
+ export function requestEncryptedAppTicket(dataToInclude?: Buffer | undefined | null): Promise<void>
405
+ /**
406
+ * Returns the encrypted app ticket that `requestEncryptedAppTicket()` asked for. Needs `init()`. Does not send a request.
407
+ * @returns the ticket as a Buffer to send to your server, or `null` when no ticket is ready.
408
+ */
409
+ export function getEncryptedAppTicket(): Buffer | null
410
+ /**
411
+ * Requests a store checkout URL that signs in the in-game browser, then redirects to `redirectUrl`. Needs `init()`.
412
+ * The SDK says the URL has a very short lifetime, so open it right away. Its auth cookie lasts a day, and the SDK suggests requesting a new URL about every 12 hours.
413
+ * Resolves with the URL. Rejects when `redirectUrl` contains a NUL character (nothing is sent), or when Steam returns an empty URL. There is no timeout: if Steam never answers, the Promise stays pending.
414
+ * @param redirectUrl - the page the store redirects to after checkout.
415
+ * @returns the store authorization URL.
416
+ */
417
+ export function requestStoreAuthUrl(redirectUrl: string): Promise<string>
254
418
  export class Ticket {
255
419
  /** Cancels the auth ticket with Steam so it can no longer be used. Call it only while the Steam client is initialized. */
256
420
  cancel(): void
@@ -285,7 +449,16 @@ export declare namespace callback {
285
449
  ScreenshotReady = 19,
286
450
  NewUrlLaunchParameters = 20,
287
451
  AuthSessionTicketResponse = 21,
288
- ValidateAuthTicketResponse = 22
452
+ ValidateAuthTicketResponse = 22,
453
+ AppProofOfPurchaseKeyResponse = 23,
454
+ GameConnectedFriendChatMsg = 24,
455
+ GameConnectedClanChatMsg = 25,
456
+ GameConnectedChatJoin = 26,
457
+ GameConnectedChatLeave = 27,
458
+ FriendRichPresenceUpdate = 28,
459
+ UnreadChatMessagesChanged = 29,
460
+ OverlayBrowserProtocolNavigation = 30,
461
+ EquippedProfileItemsChanged = 31
289
462
  }
290
463
  /**
291
464
  * Registers a handler for a Steam callback. Needs `init()`.
@@ -371,14 +544,205 @@ export declare namespace cloud {
371
544
  export function getSyncPlatforms(name: string): SyncPlatform
372
545
  /** Sets the platform a cloud file syncs to. */
373
546
  export function setSyncPlatforms(name: string, platform: SyncPlatform): void
547
+ /** The Steam Cloud quota, in bytes. */
548
+ export interface CloudQuota {
549
+ /** The total quota. */
550
+ total: bigint
551
+ /** The part of the quota that is still available. */
552
+ available: bigint
553
+ }
554
+ /**
555
+ * Returns the Steam Cloud quota in bytes. Needs `init()`. The SDK header does not say whether the quota is per account or per app; unverified against a live Steam client.
556
+ * @returns `total` and `available` as BigInts, or `null` when Steam reports no quota.
557
+ */
558
+ export function getQuota(): CloudQuota | null
559
+ /**
560
+ * Replaces the content of a Steam Cloud file with `content`, asynchronously. Needs `init()`. This sends data to Steam.
561
+ * Resolves once Steam has stored the file. The result is delivered through `runCallbacks()`, which `init()` already calls.
562
+ * Rejects when the name contains a NUL character or the content is larger than 4 GB (nothing is sent), or when Steam reports an error. There is no timeout: if Steam never answers, the Promise stays pending and the outcome is unknown.
563
+ * The header caps a file at 200 MB and a single chunk at 100 MB; Steam enforces those limits.
564
+ * @param name - The cloud file name.
565
+ * @param content - The bytes to store.
566
+ */
567
+ export function writeFileAsync(name: string, content: Buffer): Promise<void>
568
+ /**
569
+ * Opens a Steam Cloud write stream on a file, for writing content in chunks. Needs `init()`. The file changes only when `close()` commits the stream.
570
+ * Throws when the name contains a NUL character, or when Steam does not open the stream.
571
+ * @param name - The cloud file name.
572
+ * @returns the open stream.
573
+ */
574
+ export function openWriteStream(name: string): FileWriteStream
575
+ /**
576
+ * Starts a batch of cloud file writes, so that several file changes count as one, for example the two files of one save. Pair it with `endFileWriteBatch()`. Needs `init()`.
577
+ * @returns the SDK's result.
578
+ */
579
+ export function beginFileWriteBatch(): boolean
580
+ /**
581
+ * Ends a batch started with `beginFileWriteBatch()`. Needs `init()`.
582
+ * @returns the SDK's result.
583
+ */
584
+ export function endFileWriteBatch(): boolean
585
+ /** What happened to a cloud file that changed on another device, from Steam's `ERemoteStorageLocalFileChange`. */
586
+ export const enum LocalFileChangeType {
587
+ /** The SDK reports no change. */
588
+ Invalid = 0,
589
+ /** The file was updated from another device. */
590
+ FileUpdated = 1,
591
+ /** The file was deleted by another device. */
592
+ FileDeleted = 2,
593
+ /** A value this binding does not name. */
594
+ Unknown = -1
595
+ }
596
+ /** How the path of a changed cloud file is given, from Steam's `ERemoteStorageFilePathType`. */
597
+ export const enum FilePathType {
598
+ /** The SDK reports no path type. */
599
+ Invalid = 0,
600
+ /** The game reads the file directly, and the path is the full path. */
601
+ Absolute = 1,
602
+ /** The file is accessed through the Steam Cloud API, and the path is the file name. */
603
+ ApiFilename = 2,
604
+ /** A value this binding does not name. */
605
+ Unknown = -1
606
+ }
607
+ /** A cloud file that changed on another device, from `getLocalFileChanges()`. */
608
+ export interface LocalFileChange {
609
+ /** The path or file name, as the SDK gives it. */
610
+ path: string
611
+ /** What happened to the file. */
612
+ changeType: LocalFileChangeType
613
+ /** How `path` is given. */
614
+ pathType: FilePathType
615
+ }
616
+ /**
617
+ * Returns the cloud files that changed on another device since the last call. Needs `init()`.
618
+ * Entries for which the SDK returns no path are skipped.
619
+ * @returns an array of entries with `path`, `changeType` and `pathType`; empty when nothing changed.
620
+ */
621
+ export function getLocalFileChanges(): Array<LocalFileChange>
622
+ /** The result of a UGC download, from `downloadUgc()` and `downloadUgcToLocation()`. */
623
+ export interface UgcDownloadResult {
624
+ /** The handle of the downloaded file. */
625
+ handle: bigint
626
+ /** The app that created the file. */
627
+ appId: number
628
+ /** The size of the downloaded file in bytes. */
629
+ sizeInBytes: number
630
+ /** The file name the creator gave it. */
631
+ fileName: string
632
+ /** The SteamID of the user who created the content. */
633
+ owner: bigint
634
+ }
635
+ /**
636
+ * Downloads a user-generated content (UGC) file, such as a Workshop file, by its handle. Needs `init()`. This starts network transfers.
637
+ * Resolves with the file's details once the download completes; `runCallbacks()`, which `init()` already calls, drives the result.
638
+ * Rejects when `handle` is not a non-negative BigInt below 2^64, or when Steam reports an error. There is no timeout: if Steam never answers, the Promise stays pending and the outcome is unknown.
639
+ * @param handle - The UGC handle as a BigInt.
640
+ * @param priority - 0 downloads at once. A higher value waits until downloads with lower values finish; equal values download together (from the SDK header).
641
+ * @returns the file's handle, app id, size, file name and owner.
642
+ */
643
+ export function downloadUgc(handle: bigint, priority: number): Promise<UgcDownloadResult>
644
+ /**
645
+ * Downloads a UGC file like `downloadUgc()`, but to the path `location`. Needs `init()`. This starts network transfers.
646
+ * The header gives no detail on the location format, so the result of a custom location is unverified against a live Steam client.
647
+ * Rejects when `handle` is invalid, when `location` contains a NUL character (nothing is downloaded), or when Steam reports an error. There is no timeout: if Steam never answers, the Promise stays pending.
648
+ * @param handle - The UGC handle as a BigInt.
649
+ * @param location - The path to write the file to.
650
+ * @param priority - 0 downloads at once; see `downloadUgc()`.
651
+ * @returns the file's handle, app id, size, file name and owner.
652
+ */
653
+ export function downloadUgcToLocation(handle: bigint, location: string, priority: number): Promise<UgcDownloadResult>
654
+ /** Progress of a UGC download, from `getUgcDownloadProgress()`. */
655
+ export interface UgcDownloadProgress {
656
+ /** The number of bytes downloaded so far. */
657
+ bytesDownloaded: number
658
+ /** The number of bytes expected. It can be `0` before the transfer starts, so check it before dividing. */
659
+ bytesExpected: number
660
+ }
661
+ /**
662
+ * Returns how far a UGC download has progressed. Needs `init()`.
663
+ * @param handle - The UGC handle as a BigInt.
664
+ * @returns the byte counts, or `null` when Steam reports no progress for the handle.
665
+ */
666
+ export function getUgcDownloadProgress(handle: bigint): UgcDownloadProgress | null
667
+ /** Metadata of a downloaded UGC file, from `getUgcDetails()`. */
668
+ export interface UgcDetails {
669
+ /** The app that created the file. */
670
+ appId: number
671
+ /** The file name the creator gave it. Empty when Steam returns no name. */
672
+ fileName: string
673
+ /** The size of the file in bytes. */
674
+ sizeInBytes: number
675
+ /** The SteamID of the user who created the content. */
676
+ owner: bigint
677
+ }
678
+ /**
679
+ * Returns the metadata of a downloaded UGC file, the same as in the download result. Needs `init()`.
680
+ * @param handle - The UGC handle as a BigInt.
681
+ * @returns the metadata, or `null` when Steam reports no details.
682
+ */
683
+ export function getUgcDetails(handle: bigint): UgcDetails | null
684
+ /** How `readUgc()` treats the file handle after a read, from Steam's `EUGCReadAction`. */
685
+ export const enum UgcReadAction {
686
+ /** Keeps the handle open until the last byte is read, then closes it. Use it for sequential reads. */
687
+ ContinueReadingUntilFinished = 0,
688
+ /** Keeps the handle open, so the file can be read at several offsets. Finish with `Close`. */
689
+ ContinueReading = 1,
690
+ /** Frees the handle. Read the file again only after another download. */
691
+ Close = 2
692
+ }
693
+ /**
694
+ * Reads part of a downloaded UGC file into `buffer`, starting at `offset`. Needs `init()`.
695
+ * The read length is the length of `buffer`, and the bytes are written into it in place. Files over 100 MB must be read in chunks (from the SDK header). `offset` is an unsigned 32-bit value, as in the SDK.
696
+ * @param handle - The UGC handle as a BigInt.
697
+ * @param buffer - The Buffer that receives the bytes. Its length is the read length.
698
+ * @param offset - The byte offset to start reading at.
699
+ * @param action - How the handle is treated after the read.
700
+ * @returns the number of bytes read. `null` when Steam reports a negative count or the buffer is longer than 2^31 - 1 bytes; the SDK header does not define the failure value, so the `null` case is unverified.
701
+ */
702
+ export function readUgc(handle: bigint, buffer: Buffer, offset: number, action: UgcReadAction): number | null
703
+ /**
704
+ * Returns how many downloaded UGC files are waiting to be read with `readUgc()`. Needs `init()`.
705
+ * @returns the count.
706
+ */
707
+ export function getCachedUgcCount(): number
708
+ /**
709
+ * Returns the handle of a downloaded UGC file that is waiting to be read. Needs `init()`.
710
+ * @param index - The index, from 0 to the count minus one.
711
+ * @returns the handle as a BigInt, or `null` when Steam returns the invalid handle.
712
+ */
713
+ export function getCachedUgcHandle(index: number): bigint | null
374
714
  export class FileInfo {
375
715
  name: string
376
716
  size: bigint
377
717
  }
718
+ /**
719
+ * An open Steam Cloud write stream, from `openWriteStream()`. Write chunks, then call `close()` to commit them or `cancel()` to discard them.
720
+ * If the object is garbage-collected without either call, the SDK closes the stream on drop, which commits the chunks written so far.
721
+ */
722
+ export class FileWriteStream {
723
+ /**
724
+ * Writes one chunk to the stream. Nothing changes in the cloud file until `close()`. The header caps a chunk at 100 MB.
725
+ * @param data - The bytes of this chunk.
726
+ * @returns true if Steam accepted the chunk; false if the stream is already closed or Steam refused the chunk.
727
+ */
728
+ writeChunk(data: Buffer): boolean
729
+ /**
730
+ * Commits the chunks written so far, so they become the file's content. The stream cannot be used afterwards.
731
+ * @returns true if Steam accepted the commit; false if the stream was already closed or Steam refused the close.
732
+ */
733
+ close(): boolean
734
+ /**
735
+ * Discards the chunks without committing them. The stream cannot be used afterwards. The effect on the existing file is unverified against a live Steam client.
736
+ * @returns true if Steam accepted the cancel; false if the stream was already closed or Steam refused it.
737
+ */
738
+ cancel(): boolean
739
+ }
378
740
  }
379
741
  export declare namespace friends {
380
742
  export interface FriendInfo {
743
+ /** The user's SteamID64, as a BigInt. */
381
744
  steamId64: bigint
745
+ /** The user's display name. */
382
746
  name: string
383
747
  /** The nickname the local user set for this friend, or `null` when none is set. */
384
748
  nickName?: string | null
@@ -399,6 +763,178 @@ export declare namespace friends {
399
763
  LookingToPlay = 6,
400
764
  LookingToTrade = 7
401
765
  }
766
+ /** The relationship between the local user and another user (`EFriendRelationship`). */
767
+ export const enum FriendRelationship {
768
+ /** No relationship. */
769
+ None = 0,
770
+ /** The user is blocked. */
771
+ Blocked = 1,
772
+ /** The user has sent the local user a friend request. */
773
+ RequestRecipient = 2,
774
+ /** The user is a friend. */
775
+ Friend = 3,
776
+ /** The local user has sent the user a friend request. */
777
+ RequestInitiator = 4,
778
+ /** The local user ignores this user. */
779
+ Ignored = 5,
780
+ /** The user is a friend that the local user ignores. */
781
+ IgnoredFriend = 6
782
+ }
783
+ /** The kind of a chat entry (`EChatEntryType`), as the SDK numbers it. */
784
+ export const enum ChatEntryType {
785
+ /** Not a valid entry, or a value this binding does not name. */
786
+ Invalid = 0,
787
+ /** A chat message. */
788
+ ChatMsg = 1,
789
+ /** The user is typing. */
790
+ Typing = 2,
791
+ /** A game invite. */
792
+ InviteGame = 3,
793
+ /** An emote. */
794
+ Emote = 4,
795
+ /** The user left the conversation. */
796
+ LeftConversation = 6,
797
+ /** The user entered the chat room. */
798
+ Entered = 7,
799
+ /** The user was kicked. */
800
+ WasKicked = 8,
801
+ /** The user was banned. */
802
+ WasBanned = 9,
803
+ /** The user disconnected. */
804
+ Disconnected = 10,
805
+ /** A message from the chat history. */
806
+ HistoricalChat = 11,
807
+ /** A link that Steam blocked. */
808
+ LinkBlocked = 14
809
+ }
810
+ /** The answer of a clan chat room to a join request (`EChatRoomEnterResponse`). */
811
+ export const enum ChatRoomEnterResponse {
812
+ /** The join worked. Any other value means the game is not in the room. */
813
+ Success = 1,
814
+ /** The room does not exist. */
815
+ DoesntExist = 2,
816
+ /** The user may not join. */
817
+ NotAllowed = 3,
818
+ /** The room is full. */
819
+ Full = 4,
820
+ /** Steam reported an error. */
821
+ Error = 5,
822
+ /** The user is banned from the room. */
823
+ Banned = 6,
824
+ /** The user is limited from joining. */
825
+ Limited = 7,
826
+ /** The clan chat is disabled. */
827
+ ClanDisabled = 8,
828
+ /** The user is banned from the community. */
829
+ CommunityBan = 9,
830
+ /** A member of the room has blocked the user. */
831
+ MemberBlockedYou = 10,
832
+ /** The user has blocked a member of the room. */
833
+ YouBlockedMember = 11,
834
+ /** Too many join requests. */
835
+ RatelimitExceeded = 12
836
+ }
837
+ /** The kind of a Community profile item (`ECommunityProfileItemType`). */
838
+ export const enum ProfileItemType {
839
+ AnimatedAvatar = 0,
840
+ AvatarFrame = 1,
841
+ ProfileModifier = 2,
842
+ ProfileBackground = 3,
843
+ MiniProfileBackground = 4
844
+ }
845
+ /**
846
+ * A property of a Community profile item (`ECommunityProfileItemProperty`). The `AppId`, `TypeId` and `Class`
847
+ * properties are numbers; read them with `getProfileItemPropertyUint`, the others with `getProfileItemPropertyString`.
848
+ */
849
+ export const enum ProfileItemProperty {
850
+ ImageSmall = 0,
851
+ ImageLarge = 1,
852
+ InternalName = 2,
853
+ Title = 3,
854
+ Description = 4,
855
+ AppId = 5,
856
+ TypeId = 6,
857
+ Class = 7,
858
+ MovieWebM = 8,
859
+ MovieMp4 = 9,
860
+ MovieWebMSmall = 10,
861
+ MovieMp4Small = 11
862
+ }
863
+ /** A friends group (tag) of the local user, with its members. */
864
+ export interface FriendGroup {
865
+ /** The group id, for `getFriendsGroupName` and `getFriendsGroupMembers`. */
866
+ id: number
867
+ /** The group name, or an empty string when Steam returns none. */
868
+ name: string
869
+ /** The SteamID64s of the members, as far as the local Steam client knows them. */
870
+ members: Array<bigint>
871
+ }
872
+ /** How active a clan was, as the local Steam client last knew it. */
873
+ export interface ClanActivity {
874
+ /** Members online. */
875
+ online: number
876
+ /** Members in a game. */
877
+ inGame: number
878
+ /** Members in the clan chat. */
879
+ chatting: number
880
+ }
881
+ /** A clan with the data that needs no request to Steam. */
882
+ export interface ClanSummary {
883
+ /** The clan's SteamID64. */
884
+ steamId64: bigint
885
+ /** The clan name, or `null` when Steam does not know it yet. */
886
+ name?: string | null
887
+ /** The clan tag, or `null` when Steam does not know it yet. */
888
+ tag?: string | null
889
+ /** The latest activity counts, or `null` when Steam has none (see `downloadClanActivityCounts`). */
890
+ activity?: ClanActivity | null
891
+ }
892
+ /** A clan with its owner and officers, from `getClanInfo`. */
893
+ export interface ClanInfo {
894
+ /** The clan's SteamID64. */
895
+ steamId64: bigint
896
+ /** The clan name, or `null` when Steam does not know it. */
897
+ name?: string | null
898
+ /** The clan tag, or `null` when Steam does not know it. */
899
+ tag?: string | null
900
+ /** The latest activity counts, or `null` when Steam has none. */
901
+ activity?: ClanActivity | null
902
+ /** The SteamID64 of the clan owner, or `null` when it is not known. */
903
+ owner?: bigint | null
904
+ /** The SteamID64s of the officers, the owner included. */
905
+ officers: Array<bigint>
906
+ }
907
+ /** A chat message from a clan chat room or a friend chat, from `getClanChatMessage` or `getFriendMessage`. */
908
+ export interface ChatMessage {
909
+ /** The SteamID64 of the sender. For a friend message this is the friend. */
910
+ chatter: bigint
911
+ /** The kind of entry, such as a chat message or a join notice. */
912
+ entryType: ChatEntryType
913
+ /** The text of the message. It is empty for entries that carry no text, and cut at the first NUL byte. */
914
+ text: string
915
+ }
916
+ /** One page of the users the local user follows, from `enumerateFollowingList`. */
917
+ export interface FollowingPage {
918
+ /** The SteamID64s on this page, at most 50. */
919
+ steamIds: Array<bigint>
920
+ /** The total number of users in the list, across all pages. */
921
+ totalCount: number
922
+ }
923
+ /** The Community profile items a user has equipped, from `requestEquippedProfileItems`. */
924
+ export interface EquippedProfileItems {
925
+ /** The user has an animated avatar equipped. */
926
+ hasAnimatedAvatar: boolean
927
+ /** The user has an avatar frame equipped. */
928
+ hasAvatarFrame: boolean
929
+ /** The user has a profile modifier equipped. */
930
+ hasProfileModifier: boolean
931
+ /** The user has a profile background equipped. */
932
+ hasProfileBackground: boolean
933
+ /** The user has a mini profile background equipped. */
934
+ hasMiniProfileBackground: boolean
935
+ /** `true` when Steam answered from its local cache instead of asking the server. */
936
+ fromCache: boolean
937
+ }
402
938
  /** @param flags - Steam friend relationship flags (`FriendFlags` bits), e.g. `0x4` for immediate friends */
403
939
  export function getFriends(flags: number): Array<FriendInfo>
404
940
  /** Players the local user has recently played with. */
@@ -410,7 +946,10 @@ export declare namespace friends {
410
946
  * @returns the friend's `FriendState`
411
947
  */
412
948
  export function getFriendState(steamId64: bigint): FriendState
413
- /** @returns the AppID of the game the friend is playing, or `null` when they are not in a game */
949
+ /**
950
+ * @param steamId64 - SteamID64 of the friend, as a BigInt
951
+ * @returns the AppID of the game the friend is playing, or `null` when they are not in a game
952
+ */
414
953
  export function getFriendGamePlayed(steamId64: bigint): number | null
415
954
  /**
416
955
  * Returns the most recent co-play record between the local user and a friend.
@@ -418,20 +957,465 @@ export declare namespace friends {
418
957
  * @returns `appId` of the game played together (`0` when there is none) and `time`, the seconds since they last played together
419
958
  */
420
959
  export function getFriendCoplayInfo(steamId64: bigint): CoplayInfo
421
- /** @returns the small (32x32) avatar as RGBA pixels, or `null` when it has not been loaded */
960
+ /**
961
+ * @param steamId64 - SteamID64 of the friend, as a BigInt
962
+ * @returns the small (32x32) avatar as RGBA pixels, or `null` when it has not been loaded
963
+ */
422
964
  export function getSmallAvatar(steamId64: bigint): Buffer | null
423
- /** @returns the medium (64x64) avatar as RGBA pixels, or `null` when it has not been loaded */
965
+ /**
966
+ * @param steamId64 - SteamID64 of the friend, as a BigInt
967
+ * @returns the medium (64x64) avatar as RGBA pixels, or `null` when it has not been loaded
968
+ */
424
969
  export function getMediumAvatar(steamId64: bigint): Buffer | null
425
- /** @returns the large (184x184) avatar as RGBA pixels, or `null` when it has not been loaded */
970
+ /**
971
+ * @param steamId64 - SteamID64 of the friend, as a BigInt
972
+ * @returns the large (184x184) avatar as RGBA pixels, or `null` when it has not been loaded
973
+ */
426
974
  export function getLargeAvatar(steamId64: bigint): Buffer | null
427
- /** @returns true when Steam will fetch the user information asynchronously (PersonaStateChange follows) */
975
+ /**
976
+ * Asks Steam for a user's name and, unless `nameOnly` is set, avatar. Returns at once; the answer arrives later as a `PersonaStateChange` callback while `runCallbacks()` runs.
977
+ * @param steamId64 - SteamID64 of the user, as a BigInt
978
+ * @param nameOnly - `true` to skip the avatar download, which is slower and fills the local cache
979
+ * @returns true when Steam will fetch the user information asynchronously (PersonaStateChange follows), false when the data is already known
980
+ */
428
981
  export function requestUserInformation(steamId64: bigint, nameOnly: boolean): boolean
429
982
  /** Clears all of the local user's Rich Presence keys (see `localplayer.setRichPresence`). */
430
983
  export function clearRichPresence(): void
431
- /** Sends a game invite that carries `connectString` to the friend. */
984
+ /**
985
+ * Sends a game invite that carries `connectString` to the friend. The friend sees the invite in Steam; accepting it starts the game with that connect string. This sends data to another user.
986
+ * Throws when `connectString` contains a NUL character.
987
+ * @param steamId64 - SteamID64 of the friend to invite, as a BigInt
988
+ * @param connectString - The connect string the game receives when the invite is accepted
989
+ */
432
990
  export function inviteUserToGame(steamId64: bigint, connectString: string): void
433
- /** Marks the user as played with. The local user must currently be in game with them. */
991
+ /**
992
+ * Marks the user as played with. The local user must currently be in game with them.
993
+ * @param steamId64 - SteamID64 of the user, as a BigInt
994
+ */
434
995
  export function setPlayedWith(steamId64: bigint): void
996
+ /**
997
+ * Returns the local user's own persona state (online, away, invisible, ...), as the local Steam client reports it.
998
+ * Requires a running Steam client.
999
+ * @returns the local user's `FriendState`
1000
+ */
1001
+ export function getPersonaState(): FriendState
1002
+ /**
1003
+ * Returns the relationship between the local user and a user (friend, blocked, pending request, ...).
1004
+ * @param steamId64 - SteamID64 of the user, as a BigInt
1005
+ * @returns the `FriendRelationship`, or `null` for the deprecated suggested value or a value this binding does not name
1006
+ */
1007
+ export function getFriendRelationship(steamId64: bigint): FriendRelationship | null
1008
+ /**
1009
+ * Returns an earlier display name of a user. Index `0` is the name before the current one.
1010
+ * @param steamId64 - SteamID64 of the user, as a BigInt
1011
+ * @param index - Position in the name history, counting back from the current name
1012
+ * @returns the old name, or `null` when there is no name at that index (the end of the history)
1013
+ */
1014
+ export function getFriendPersonaNameHistory(steamId64: bigint, index: number): string | null
1015
+ /**
1016
+ * Returns the Steam level of a user. It can be `0` until the local Steam client has the data (unverified against a live Steam client).
1017
+ * @param steamId64 - SteamID64 of the user, as a BigInt
1018
+ * @returns the Steam level
1019
+ */
1020
+ export function getFriendSteamLevel(steamId64: bigint): number
1021
+ /**
1022
+ * Returns the number of friends groups the local user has.
1023
+ * @returns the number of groups; `getFriendsGroupId` takes an index from `0` to this count minus one
1024
+ */
1025
+ export function getFriendsGroupCount(): number
1026
+ /**
1027
+ * Returns the id of the friends group at an index.
1028
+ * @param index - Index from `0` to `getFriendsGroupCount()` minus one
1029
+ * @returns the group id, or `null` when the index is not a group
1030
+ */
1031
+ export function getFriendsGroupId(index: number): number | null
1032
+ /**
1033
+ * Returns the name of a friends group.
1034
+ * @param groupId - Group id from `getFriendsGroupId`
1035
+ * @returns the name, or `null` when the id is not a group or the name is empty
1036
+ */
1037
+ export function getFriendsGroupName(groupId: number): string | null
1038
+ /**
1039
+ * Returns the number of members of a friends group.
1040
+ * @param groupId - Group id from `getFriendsGroupId`
1041
+ * @returns the number of members; `0` when the id is not a group
1042
+ */
1043
+ export function getFriendsGroupMembersCount(groupId: number): number
1044
+ /**
1045
+ * Returns the members of a friends group.
1046
+ * @param groupId - Group id from `getFriendsGroupId`
1047
+ * @returns the SteamID64s of the members; empty when the id is not a group. Slots Steam leaves empty are skipped.
1048
+ */
1049
+ export function getFriendsGroupMembers(groupId: number): Array<bigint>
1050
+ /**
1051
+ * Returns every friends group with its name and members, in index order.
1052
+ * @returns one `FriendGroup` per group, with `id`, `name` and `members` (SteamID64s as BigInt)
1053
+ */
1054
+ export function getFriendGroups(): Array<FriendGroup>
1055
+ /**
1056
+ * Returns the number of clans (groups) the local user is a member of.
1057
+ * @returns the number of clans; `getClanByIndex` takes an index from `0` to this count minus one
1058
+ */
1059
+ export function getClanCount(): number
1060
+ /**
1061
+ * Returns the SteamID64 of the clan at an index.
1062
+ * @param index - Index from `0` to `getClanCount()` minus one
1063
+ * @returns the clan's SteamID64 as a BigInt, or `null` when the SDK returns an invalid id
1064
+ */
1065
+ export function getClanByIndex(index: number): bigint | null
1066
+ /**
1067
+ * Returns the name of a clan. The local Steam client may not know it yet.
1068
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1069
+ * @returns the name, or `null` when Steam does not know it or the name is empty
1070
+ */
1071
+ export function getClanName(steamId64: bigint): string | null
1072
+ /**
1073
+ * Returns the tag of a clan. The local Steam client may not know it yet.
1074
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1075
+ * @returns the tag, or `null` when Steam does not know it or the tag is empty
1076
+ */
1077
+ export function getClanTag(steamId64: bigint): string | null
1078
+ /**
1079
+ * Returns the latest activity counts Steam knows for a clan. A clan the user is not a member of has counts only after `downloadClanActivityCounts`.
1080
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1081
+ * @returns the counts (`online`, `inGame`, `chatting`), or `null` when Steam has none
1082
+ */
1083
+ export function getClanActivityCounts(steamId64: bigint): ClanActivity | null
1084
+ /**
1085
+ * Returns every clan of the local user with its name, tag and activity counts. This makes no request to Steam, so
1086
+ * the owner and officers are not included; use `getClanInfo` for them.
1087
+ * @returns one `ClanSummary` per clan
1088
+ */
1089
+ export function getClans(): Array<ClanSummary>
1090
+ /**
1091
+ * Returns the owner of a clan. It is known only after `requestClanOfficerList` (or `getClanInfo`) has completed.
1092
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1093
+ * @returns the owner's SteamID64, or `null` when it is not known
1094
+ */
1095
+ export function getClanOwner(steamId64: bigint): bigint | null
1096
+ /**
1097
+ * Returns the number of officers of a clan, the owner included. Known only after `requestClanOfficerList` has completed.
1098
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1099
+ * @returns the number of officers
1100
+ */
1101
+ export function getClanOfficerCount(steamId64: bigint): number
1102
+ /**
1103
+ * Returns an officer of a clan. Known only after `requestClanOfficerList` has completed.
1104
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1105
+ * @param index - Index from `0` to `getClanOfficerCount()` minus one
1106
+ * @returns the officer's SteamID64, or `null` for an invalid id
1107
+ */
1108
+ export function getClanOfficerByIndex(steamId64: bigint, index: number): bigint | null
1109
+ /**
1110
+ * Returns whether a clan is public. Unknown clans may be reported as not public (unverified against a live Steam client).
1111
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1112
+ * @returns true if the clan is public
1113
+ */
1114
+ export function isClanPublic(steamId64: bigint): boolean
1115
+ /**
1116
+ * Returns whether a clan is the official game group of an app (unverified against a live Steam client).
1117
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1118
+ * @returns true if the clan is an official game group
1119
+ */
1120
+ export function isClanOfficialGameGroup(steamId64: bigint): boolean
1121
+ /**
1122
+ * Returns how many users the local user can see in a source (a clan, lobby, chat room or game server).
1123
+ * @param sourceId64 - The source's SteamID64, as a BigInt
1124
+ * @returns the number of users the local Steam client knows in that source
1125
+ */
1126
+ export function getFriendCountFromSource(sourceId64: bigint): number
1127
+ /**
1128
+ * Returns a user at an index in a source (see `getFriendCountFromSource`).
1129
+ * @param sourceId64 - The source's SteamID64, as a BigInt
1130
+ * @param index - Index from `0` to `getFriendCountFromSource(sourceId64)` minus one
1131
+ * @returns the user's SteamID64, or `null` for an invalid id
1132
+ */
1133
+ export function getFriendFromSourceByIndex(sourceId64: bigint, index: number): bigint | null
1134
+ /**
1135
+ * Returns whether the local user can see that a user is a member of, or in, a source.
1136
+ * @param userId64 - The user's SteamID64, as a BigInt
1137
+ * @param sourceId64 - The source's SteamID64, as a BigInt
1138
+ * @returns true if the user is in the source as far as the local Steam client knows
1139
+ */
1140
+ export function isUserInSource(userId64: bigint, sourceId64: bigint): boolean
1141
+ /**
1142
+ * Tells Steam that a user is pressing the talk button in the current game, which mutes the microphone of Steam friends voice chat for that user. Affects only the Steam client's friends UI (unverified against a live Steam client).
1143
+ * @param steamId64 - The user's SteamID64, as a BigInt
1144
+ * @param speaking - `true` while the talk button is pressed
1145
+ */
1146
+ export function setInGameVoiceSpeaking(steamId64: bigint, speaking: boolean): void
1147
+ /**
1148
+ * Returns how many chats (friends or chat rooms) have unread messages that would show a notification. Watch the `UnreadChatMessagesChanged` callback to see when it changes.
1149
+ * @returns the number of chats with unread priority messages
1150
+ */
1151
+ export function getNumChatsWithUnreadPriorityMessages(): number
1152
+ /**
1153
+ * Opens the overlay's Remote Play Together invite dialog for a lobby. The user sends the invitations in the dialog. Requires the Steam overlay.
1154
+ * @param lobbyId - The lobby's id, as a BigInt
1155
+ */
1156
+ export function activateRemotePlayTogetherInviteDialog(lobbyId: bigint): void
1157
+ /**
1158
+ * Makes the overlay browser report navigations to a protocol instead of opening them. Steam then posts the `OverlayBrowserProtocolNavigation` callback.
1159
+ * Throws when `protocol` contains a NUL character.
1160
+ * @param protocol - The protocol name, for example `myapp`
1161
+ * @returns true when Steam accepted the protocol
1162
+ */
1163
+ export function registerProtocolInOverlayBrowser(protocol: string): boolean
1164
+ /**
1165
+ * Joins a clan chat room from inside the game. Resolves once Steam has answered; the request is driven by `runCallbacks()`.
1166
+ * Rejects when no answer arrives. Check the result: only `ChatRoomEnterResponse.Success` means the game is in the room.
1167
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1168
+ * @returns the room's `ChatRoomEnterResponse`
1169
+ */
1170
+ export function joinClanChatRoom(steamId64: bigint): Promise<ChatRoomEnterResponse>
1171
+ /**
1172
+ * Leaves a clan chat room the game has joined.
1173
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1174
+ * @returns true if Steam accepted the request, otherwise false (for example when the room is not joined)
1175
+ */
1176
+ export function leaveClanChatRoom(steamId64: bigint): boolean
1177
+ /**
1178
+ * Returns the number of members in a clan chat room the game has joined.
1179
+ * @param clanChatId64 - The chat room's SteamID64, as a BigInt
1180
+ * @returns the number of members
1181
+ */
1182
+ export function getClanChatMemberCount(clanChatId64: bigint): number
1183
+ /**
1184
+ * Returns a member of a clan chat room the game has joined.
1185
+ * @param clanChatId64 - The chat room's SteamID64, as a BigInt
1186
+ * @param index - Index from `0` to `getClanChatMemberCount` minus one
1187
+ * @returns the member's SteamID64, or `null` for an invalid id
1188
+ */
1189
+ export function getClanChatMemberByIndex(clanChatId64: bigint, index: number): bigint | null
1190
+ /**
1191
+ * Sends a message to a clan chat room the game has joined. The message is posted for every member of the room.
1192
+ * Throws when `text` contains a NUL character.
1193
+ * @param clanChatId64 - The chat room's SteamID64, as a BigInt
1194
+ * @param text - The message text
1195
+ * @returns true if Steam accepted the message
1196
+ */
1197
+ export function sendClanChatMessage(clanChatId64: bigint, text: string): boolean
1198
+ /**
1199
+ * Reads a message from a clan chat room the game has joined. Messages longer than 8192 bytes are cut.
1200
+ * @param clanChatId64 - The chat room's SteamID64, as a BigInt
1201
+ * @param index - The message index, from the `GameConnectedClanChatMsg` callback's `messageId`
1202
+ * @returns the `ChatMessage`, or `null` when Steam returns a negative length (whether an out-of-range index gives `null` is unverified against a live Steam client)
1203
+ */
1204
+ export function getClanChatMessage(clanChatId64: bigint, index: number): ChatMessage | null
1205
+ /**
1206
+ * Returns whether a user is an admin of a clan chat room.
1207
+ * @param clanChatId64 - The chat room's SteamID64, as a BigInt
1208
+ * @param userId64 - The user's SteamID64, as a BigInt
1209
+ * @returns true if the user is an admin
1210
+ */
1211
+ export function isClanChatAdmin(clanChatId64: bigint, userId64: bigint): boolean
1212
+ /**
1213
+ * Returns whether the clan chat window is open in the Steam client, outside the game.
1214
+ * @param clanChatId64 - The chat room's SteamID64, as a BigInt
1215
+ * @returns true if the window is open
1216
+ */
1217
+ export function isClanChatWindowOpenInSteam(clanChatId64: bigint): boolean
1218
+ /**
1219
+ * Opens the clan chat window in the Steam client, outside the game. This changes what the user sees.
1220
+ * @param clanChatId64 - The chat room's SteamID64, as a BigInt
1221
+ * @returns true if Steam opened it
1222
+ */
1223
+ export function openClanChatWindowInSteam(clanChatId64: bigint): boolean
1224
+ /**
1225
+ * Closes the clan chat window in the Steam client. This changes what the user sees.
1226
+ * @param clanChatId64 - The chat room's SteamID64, as a BigInt
1227
+ * @returns true if Steam closed it
1228
+ */
1229
+ export function closeClanChatWindowInSteam(clanChatId64: bigint): boolean
1230
+ /**
1231
+ * Turns on or off the interception of friend-to-friend chat messages. While it is on, the game gets them through the `GameConnectedFriendChatMsg` callback and reads them with `getFriendMessage`, and the Steam client does not show them.
1232
+ * @param enabled - `true` to intercept, `false` to restore the Steam client's own handling
1233
+ * @returns true if Steam accepted the change
1234
+ */
1235
+ export function setListenForFriendsMessages(enabled: boolean): boolean
1236
+ /**
1237
+ * Sends a chat message to a friend. The message is delivered to the friend.
1238
+ * Throws when `text` contains a NUL character.
1239
+ * @param steamId64 - The friend's SteamID64, as a BigInt
1240
+ * @param text - The message text
1241
+ * @returns true if Steam accepted the message
1242
+ */
1243
+ export function replyToFriendMessage(steamId64: bigint, text: string): boolean
1244
+ /**
1245
+ * Reads a friend chat message. Use it after the `GameConnectedFriendChatMsg` callback, with that callback's `messageId`. Messages longer than 8192 bytes are cut.
1246
+ * @param steamId64 - The friend's SteamID64, as a BigInt
1247
+ * @param index - The message id from the `GameConnectedFriendChatMsg` callback
1248
+ * @returns the `ChatMessage` (its `chatter` is the friend), or `null` when Steam returns a negative length (unverified against a live Steam client)
1249
+ */
1250
+ export function getFriendMessage(steamId64: bigint, index: number): ChatMessage | null
1251
+ /**
1252
+ * Asks Steam how many users follow a user. Resolves with the count; the request is driven by `runCallbacks()`.
1253
+ * Rejects when no answer arrives or Steam reports an error.
1254
+ * @param steamId64 - The user's SteamID64, as a BigInt
1255
+ * @returns the number of followers
1256
+ */
1257
+ export function getFollowerCount(steamId64: bigint): Promise<number>
1258
+ /**
1259
+ * Asks Steam whether the local user follows a user. Resolves with the answer; the request is driven by `runCallbacks()`.
1260
+ * Rejects when no answer arrives or Steam reports an error.
1261
+ * @param steamId64 - The user's SteamID64, as a BigInt
1262
+ * @returns true if the local user follows the user
1263
+ */
1264
+ export function isFollowing(steamId64: bigint): Promise<boolean>
1265
+ /**
1266
+ * Asks Steam for one page of the users the local user follows. Resolves with the page; the request is driven by `runCallbacks()`.
1267
+ * Rejects when no answer arrives or Steam reports an error.
1268
+ * @param startIndex - Index of the first user on the page, from `0`
1269
+ * @returns the page: `steamIds` (at most 50 SteamID64s) and `totalCount`, the size of the whole list
1270
+ */
1271
+ export function enumerateFollowingList(startIndex: number): Promise<FollowingPage>
1272
+ /**
1273
+ * Asks Steam which Community profile items a user has equipped. Resolves once Steam has answered; the request is driven by `runCallbacks()`. Read the items with `hasEquippedProfileItem` and the property functions after it resolves.
1274
+ * Rejects when no answer arrives or Steam reports an error.
1275
+ * @param steamId64 - The user's SteamID64, as a BigInt
1276
+ * @returns the equipped flags and `fromCache`
1277
+ */
1278
+ export function requestEquippedProfileItems(steamId64: bigint): Promise<EquippedProfileItems>
1279
+ /**
1280
+ * Returns whether a user has equipped a profile item of that kind. Valid only after `requestEquippedProfileItems` has resolved for that user.
1281
+ * @param steamId64 - The user's SteamID64, as a BigInt
1282
+ * @param itemType - The kind of profile item (`ProfileItemType`)
1283
+ * @returns true if the user has one equipped
1284
+ */
1285
+ export function hasEquippedProfileItem(steamId64: bigint, itemType: ProfileItemType): boolean
1286
+ /**
1287
+ * Returns a text property of an equipped profile item. Valid only after `requestEquippedProfileItems` has resolved for that user.
1288
+ * @param steamId64 - The user's SteamID64, as a BigInt
1289
+ * @param itemType - The kind of profile item (`ProfileItemType`)
1290
+ * @param property - The property to read (`ProfileItemProperty`)
1291
+ * @returns the value, or `null` when Steam has none
1292
+ */
1293
+ export function getProfileItemPropertyString(steamId64: bigint, itemType: ProfileItemType, property: ProfileItemProperty): string | null
1294
+ /**
1295
+ * Returns a number property of an equipped profile item (`AppId`, `TypeId` or `Class`). Valid only after `requestEquippedProfileItems` has resolved for that user.
1296
+ * @param steamId64 - The user's SteamID64, as a BigInt
1297
+ * @param itemType - The kind of profile item (`ProfileItemType`)
1298
+ * @param property - The property to read (`ProfileItemProperty`)
1299
+ * @returns the value, or `0` when Steam has none
1300
+ */
1301
+ export function getProfileItemPropertyUint(steamId64: bigint, itemType: ProfileItemType, property: ProfileItemProperty): number
1302
+ /**
1303
+ * Asks Steam for a user's Rich Presence. Steam posts the `FriendRichPresenceUpdate` callback when the data arrives; read it with `getFriendRichPresence` after that.
1304
+ * @param steamId64 - The user's SteamID64, as a BigInt
1305
+ */
1306
+ export function requestFriendRichPresence(steamId64: bigint): void
1307
+ /**
1308
+ * Returns the Rich Presence value a user has set for a key (for example `status`).
1309
+ * Throws when `key` contains a NUL character.
1310
+ * @param steamId64 - The user's SteamID64, as a BigInt
1311
+ * @param key - The Rich Presence key
1312
+ * @returns the value, or `null` when the user has not set the key
1313
+ */
1314
+ export function getFriendRichPresence(steamId64: bigint, key: string): string | null
1315
+ /**
1316
+ * Returns how many Rich Presence keys a user currently has, for listing them with `getFriendRichPresenceKey`.
1317
+ * @param steamId64 - The user's SteamID64, as a BigInt
1318
+ * @returns the number of keys
1319
+ */
1320
+ export function getFriendRichPresenceKeyCount(steamId64: bigint): number
1321
+ /**
1322
+ * Returns a Rich Presence key of a user by its index (typically used for debugging).
1323
+ * @param steamId64 - The user's SteamID64, as a BigInt
1324
+ * @param index - Index from `0` to `getFriendRichPresenceKeyCount` minus one
1325
+ * @returns the key name, or `null` when there is none at that index
1326
+ */
1327
+ export function getFriendRichPresenceKey(steamId64: bigint, index: number): string | null
1328
+ /**
1329
+ * Downloads activity counts for clans the local user is not a member of. Resolves when Steam has answered; the request is driven by `runCallbacks()`. Afterwards `getClanActivityCounts` and `getClans` return the counts.
1330
+ * Rejects when no answer arrives or Steam reports failure.
1331
+ * @param clanIds - The clans' SteamID64s, as BigInts
1332
+ */
1333
+ export function downloadClanActivityCounts(clanIds: Array<bigint>): Promise<void>
1334
+ /**
1335
+ * Asks Steam for a clan's officer list, which gives the owner and the officers. Only a member of the clan can ask. Resolves with the number of officers, the owner included; the request is driven by `runCallbacks()`.
1336
+ * Rejects when no answer arrives or Steam reports failure.
1337
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1338
+ * @returns the number of officers, the owner included
1339
+ */
1340
+ export function requestClanOfficerList(steamId64: bigint): Promise<number>
1341
+ /**
1342
+ * Returns a clan with its owner and officers. It asks Steam for the officer list first, so it resolves after the officer list has arrived; the request is driven by `runCallbacks()`.
1343
+ * Rejects when no answer arrives or Steam reports failure. Use `getClans` to read many clans without this request.
1344
+ * @param steamId64 - The clan's SteamID64, as a BigInt
1345
+ * @returns the `ClanInfo` with name, tag, activity counts, owner and officers
1346
+ */
1347
+ export function getClanInfo(steamId64: bigint): Promise<ClanInfo>
1348
+ }
1349
+ export declare namespace http {
1350
+ /** Options for `request()`. Only `method` and `url` are required. */
1351
+ export interface RequestOptions {
1352
+ /** HTTP method: `GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `OPTIONS` or `PATCH`, in any letter case. */
1353
+ method: string
1354
+ /** Absolute URL. It must start with `http://` or `https://`. */
1355
+ url: string
1356
+ /** Request headers, by name. Steam may reject a header name or value it does not accept. */
1357
+ headers?: Record<string, string>
1358
+ /** GET parameters. Steam adds them to the URL for a `GET` request, and they are sent as form data for other methods. */
1359
+ query?: Record<string, string>
1360
+ /** POST parameters, sent form-encoded. Steam sends them the same way as `query` for non-GET methods. Cannot be combined with `body`. */
1361
+ form?: Record<string, string>
1362
+ /** Raw request body, for `POST` (and methods Steam accepts a body for). Cannot be combined with `form` or `query`. */
1363
+ body?: Buffer
1364
+ /** `Content-Type` of `body`. Defaults to `application/octet-stream`, and is only allowed together with `body`. */
1365
+ contentType?: string
1366
+ /** Total time limit for the request, in milliseconds. Unlike the network inactivity timeout, it does not reset when data arrives. Steam's default is no total limit. */
1367
+ timeoutMs?: number
1368
+ /** Text appended to the user agent. The normal user agent is kept. */
1369
+ userAgent?: string
1370
+ /** Whether HTTPS certificates must be verified. Defaults to `true`. Turning it off is unverified against a live Steam client. */
1371
+ requireVerifiedCertificate?: boolean
1372
+ /** Cookie container from `createCookieContainer()`, to send and store cookies with this request. */
1373
+ cookieContainer?: CookieContainer
1374
+ /** Names of the response headers to return in `headers`. Steam has no way to list all response headers, so name each one you need. */
1375
+ responseHeaders?: Array<string>
1376
+ }
1377
+ /** A completed request. `request()` resolves with it when the server answered, whatever the status code. */
1378
+ export interface HttpResponse {
1379
+ /** HTTP status code the server returned, for example `200` or `404`. Check it yourself: error statuses still resolve. */
1380
+ status: number
1381
+ /** The headers named in `responseHeaders` that the response contains, with names as you wrote them. */
1382
+ headers: Record<string, string>
1383
+ /** Response body bytes. Empty for `HEAD` requests and for responses without a body. */
1384
+ body: Buffer
1385
+ /** `true` when the request timed out. A timeout normally rejects the promise instead, so this is `false` on a resolved response. */
1386
+ wasTimedOut: boolean
1387
+ }
1388
+ /**
1389
+ * Creates a cookie container that requests can share. Needs `init()`.
1390
+ * @param allowResponsesToModify - When `true`, responses to requests using the container may add cookies that are sent with later requests. When `false`, only cookies added with `setCookie()` are sent.
1391
+ * @returns The new container. Throws when Steam returns no handle.
1392
+ */
1393
+ export function createCookieContainer(allowResponsesToModify: boolean): CookieContainer
1394
+ /**
1395
+ * Sends an HTTP request through the Steam client and resolves with the response. Needs `init()`, and the Steam client must be running.
1396
+ * The request is driven by `runCallbacks()`, so call it regularly while the promise is pending. The request handle is released on every path, including failures.
1397
+ *
1398
+ * The promise rejects when the request cannot be created or sent, when a header or option is refused, when Steam cannot complete the request, when no answer comes from the server, or when the request times out.
1399
+ * It resolves for every answer the server gives, including error statuses such as 404 or 500.
1400
+ * Requests are sent through the Steam client. Whether HTTPS validation behaves the same as in a browser is unverified against a live Steam client.
1401
+ * @param options - The request. `method` and `url` are required.
1402
+ * @returns The response with its status, the requested headers and the body.
1403
+ */
1404
+ export function request(options: RequestOptions): Promise<HttpResponse>
1405
+ /**
1406
+ * A cookie container for requests. Cookies stay in the Steam client for this process only and are not saved between runs.
1407
+ * It is released when it is no longer referenced by JavaScript and no request is still using it.
1408
+ */
1409
+ export class CookieContainer {
1410
+ /**
1411
+ * Adds a cookie that requests using this container send to `url`. Needs `init()`.
1412
+ * @param host - The host the cookie belongs to, for example `example.com`.
1413
+ * @param url - The URL the cookie applies to, starting with `http://` or `https://`.
1414
+ * @param cookie - A `Set-Cookie`-style value, for example `session=abc; Path=/`.
1415
+ * @returns Throws when an argument contains a NUL character or Steam refuses the cookie.
1416
+ */
1417
+ setCookie(host: string, url: string, cookie: string): void
1418
+ }
435
1419
  }
436
1420
  export declare namespace input {
437
1421
  export const enum InputType {
@@ -479,68 +1463,451 @@ export declare namespace input {
479
1463
  */
480
1464
  export function getDigitalAction(actionName: string): bigint
481
1465
  /**
482
- * Looks up the handle of an analog action defined in the game's Steam Input configuration.
483
- * @param actionName - name of the analog action, as it is defined in the Steam Input configuration
484
- * @returns the action handle as a BigInt. Unverified against a live Steam client: a name that is not found is expected to return `0`.
1466
+ * Looks up the handle of an analog action defined in the game's Steam Input configuration.
1467
+ * @param actionName - name of the analog action, as it is defined in the Steam Input configuration
1468
+ * @returns the action handle as a BigInt. Unverified against a live Steam client: a name that is not found is expected to return `0`.
1469
+ */
1470
+ export function getAnalogAction(actionName: string): bigint
1471
+ /** Shuts down Steam Input. Call `init` again before using controllers or actions after this. */
1472
+ export function shutdown(): void
1473
+ export interface DigitalActionData {
1474
+ /** `true` while the digital action is pressed. */
1475
+ state: boolean
1476
+ /** `false` when the action is not available for this controller. */
1477
+ active: boolean
1478
+ }
1479
+ export interface AnalogActionData {
1480
+ x: number
1481
+ y: number
1482
+ /** `false` when the action is not available for this controller. */
1483
+ active: boolean
1484
+ }
1485
+ /**
1486
+ * @param controllerHandle - a controller handle from `getConnectedControllers`
1487
+ * @param actionHandle - a digital action handle from `getDigitalAction`
1488
+ */
1489
+ export function getDigitalActionData(controllerHandle: bigint, actionHandle: bigint): DigitalActionData
1490
+ /** @param actionHandle - an analog action handle from `getAnalogAction` */
1491
+ export function getAnalogActionData(controllerHandle: bigint, actionHandle: bigint): AnalogActionData
1492
+ /** @returns the Steam action origins (numeric `EInputActionOrigin` values) bound to a digital action; empty when unbound */
1493
+ export function getDigitalActionOrigins(controllerHandle: bigint, actionSetHandle: bigint, actionHandle: bigint): Array<number>
1494
+ /** @returns the Steam action origins (numeric `EInputActionOrigin` values) bound to an analog action; empty when unbound */
1495
+ export function getAnalogActionOrigins(controllerHandle: bigint, actionSetHandle: bigint, actionHandle: bigint): Array<number>
1496
+ /** @returns the display name of an action origin, such as "A Button"; empty for an unknown origin */
1497
+ export function getStringForActionOrigin(origin: number): string
1498
+ /** @returns the glyph image path of an action origin */
1499
+ export function getGlyphForActionOrigin(origin: number): string
1500
+ export class Controller {
1501
+ /**
1502
+ * Switches this controller to an action set. The call is cheap and can be repeated safely.
1503
+ * @param actionSetHandle - action set handle from `getActionSet`
1504
+ */
1505
+ activateActionSet(actionSetHandle: bigint): void
1506
+ /**
1507
+ * Checks whether a digital action is pressed on this controller.
1508
+ * @param actionHandle - digital action handle from `getDigitalAction`
1509
+ * @returns `true` while the action is pressed, otherwise `false`
1510
+ */
1511
+ isDigitalActionPressed(actionHandle: bigint): boolean
1512
+ /**
1513
+ * Reads the current vector of an analog action on this controller.
1514
+ * @param actionHandle - analog action handle from `getAnalogAction`
1515
+ * @returns `x` and `y` as reported by Steam Input. Unverified against a live Steam client: the value ranges are not checked here.
1516
+ */
1517
+ getAnalogActionVector(actionHandle: bigint): AnalogActionVector
1518
+ /**
1519
+ * Identifies the type of this controller.
1520
+ * @returns the controller's `InputType`, `Unknown` when Steam cannot identify it
1521
+ */
1522
+ getType(): InputType
1523
+ /**
1524
+ * Returns the Steam Input handle of this controller.
1525
+ * @returns the handle as a BigInt, the value used by controller-scoped Steam Input calls
1526
+ */
1527
+ getHandle(): bigint
1528
+ }
1529
+ }
1530
+ export declare namespace inventory {
1531
+ /** One item instance of an inventory result. */
1532
+ export interface ItemDetails {
1533
+ /** The globally unique id of this item instance. It is a `bigint` because it can exceed 2^53, and it is never reused for another item. */
1534
+ itemId: bigint
1535
+ /** The item definition id, a number between 1 and 999999999. */
1536
+ definition: number
1537
+ /** The stack size of the item. */
1538
+ quantity: number
1539
+ /** Status and action flags: `1` cannot be traded, `256` was removed (destroyed, traded away or expired), `512` was consumed by one `consumeItem` call. */
1540
+ flags: number
1541
+ }
1542
+ /** The items of a finished inventory result. */
1543
+ export interface InventoryResultData {
1544
+ /** The item instances in the result. Empty when the result holds no items. */
1545
+ items: Array<ItemDetails>
1546
+ /** The server time at which Steam generated the result, in Unix seconds (unverified against a live Steam client). */
1547
+ timestamp: number
1548
+ /** `true` when Steam marked the result as possibly out of date (for example after an item was traded or consumed). The items are still valid to read. */
1549
+ expired: boolean
1550
+ }
1551
+ /** A definition quantity pair, used to grant, generate or exchange items. */
1552
+ export interface ItemQuantity {
1553
+ /** The item definition id, a number between 1 and 999999999. */
1554
+ definition: number
1555
+ /** How many items of that definition to use or create. */
1556
+ quantity: number
1557
+ }
1558
+ /** An item instance quantity pair, used to consume, exchange or trade items the user already has. */
1559
+ export interface ItemInstanceQuantity {
1560
+ /** The instance id of the item, as in `ItemDetails.itemId`. */
1561
+ itemId: bigint
1562
+ /** How many of that item to use. */
1563
+ quantity: number
1564
+ }
1565
+ /** An item definition with all of its string properties. */
1566
+ export interface ItemDefinition {
1567
+ /** The item definition id. */
1568
+ id: number
1569
+ /** Every property the definition has, by name. Some values (such as `name`) are localized for the current Steam language. A property whose value cannot be read is left out. */
1570
+ properties: Record<string, string>
1571
+ }
1572
+ /** The price of one item definition, in the currency that `requestPrices()` reported. */
1573
+ export interface ItemPrice {
1574
+ /** The item definition id. */
1575
+ definition: number
1576
+ /** The current price, after any sale, in the currency's smallest unit (unverified against a live Steam client). A `bigint` because it can exceed 2^53. */
1577
+ currentPrice: bigint
1578
+ /** The base price, without any sale, in the same unit as `currentPrice`. */
1579
+ basePrice: bigint
1580
+ }
1581
+ /** The answer to `requestPrices()`. */
1582
+ export interface PricesReceived {
1583
+ /** The currency code the prices are in, for example `USD`, as Steam reports it. */
1584
+ currency: string
1585
+ }
1586
+ /** The answer to `requestEligiblePromoItems()`. */
1587
+ export interface EligiblePromoItems {
1588
+ /** The item definition ids the user can be granted manually with `addPromoItem()`. */
1589
+ itemDefinitions: Array<number>
1590
+ /** `true` when Steam answered from its cache instead of the server. */
1591
+ cached: boolean
1592
+ }
1593
+ /** The answer to `startPurchase()`. The purchase itself is completed by the user in the Steam overlay. */
1594
+ export interface PurchaseStarted {
1595
+ /** The order id Steam assigned to the purchase, as a `bigint`. */
1596
+ orderId: bigint
1597
+ /** The transaction id Steam assigned to the purchase, as a `bigint`. */
1598
+ transactionId: bigint
1599
+ }
1600
+ /**
1601
+ * Captures the whole inventory of the current user. Resolves with its items.
1602
+ *
1603
+ * Steam may rate-limit this and return a cached copy, so call it when the inventory is about to be shown, not on every frame. Read-only: it changes nothing.
1604
+ * Rejects when Steam cannot start the query, when it reports an error, or when no answer arrives in time.
1605
+ *
1606
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1607
+ * @returns the items of the inventory and the time Steam generated them.
1608
+ */
1609
+ export function getAllItems(timeoutMs?: number | undefined | null): Promise<InventoryResultData>
1610
+ /**
1611
+ * Captures the state of some items of the current user, by instance id. Resolves with those items only.
1612
+ *
1613
+ * Read-only. The result can be serialized with `serializeItems()` and checked by another player.
1614
+ * Rejects when an id is negative or too large, when Steam reports an error, or when no answer arrives in time.
1615
+ *
1616
+ * @param itemIds - The instance ids of the items to read, as `bigint` values.
1617
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1618
+ * @returns the requested items that the user owns.
1619
+ */
1620
+ export function getItemsById(itemIds: Array<bigint>, timeoutMs?: number | undefined | null): Promise<InventoryResultData>
1621
+ /**
1622
+ * Serializes the named items into a signed buffer, so that another player can verify ownership with `deserializeResult()`.
1623
+ *
1624
+ * Read-only. It builds a small result with `getItemsByID`, as the SDK recommends, and then serializes it. Steam marks the buffer `expired` after one hour; the check in `deserializeResult()` then still returns the items, with `expired` set.
1625
+ * Rejects when an id is invalid, when Steam reports an error, or when no answer arrives in time.
1626
+ *
1627
+ * @param itemIds - The instance ids of the items to prove, as `bigint` values.
1628
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1629
+ * @returns the serialized, signed result.
1630
+ */
1631
+ export function serializeItems(itemIds: Array<bigint>, timeoutMs?: number | undefined | null): Promise<Buffer>
1632
+ /**
1633
+ * Checks a buffer made by `serializeItems()` and reads the items in it. This runs synchronously and does not wait for Steam.
1634
+ *
1635
+ * Read-only. Returns `null` when Steam rejects the buffer (for example because it was altered), when Steam is offline and needs a full online check, or when the items belong to a different user than `expectedSteamId`. Always pass the id of the player who sent the buffer, so that nobody can pass off another player's items.
1636
+ *
1637
+ * @param data - The buffer received from another player.
1638
+ * @param expectedSteamId - The 64-bit Steam id of the player who should own the items, as a `bigint`.
1639
+ * @returns the verified items with `expired` set when the buffer is out of date, or `null` when verification fails.
1640
+ */
1641
+ export function deserializeResult(data: Buffer, expectedSteamId: bigint): InventoryResultData | null
1642
+ /**
1643
+ * Creates new items in the user's inventory. Resolves with the created items.
1644
+ *
1645
+ * This changes the user's real inventory. Steam accepts it only from accounts in the game's publisher group, and only for prototyping.
1646
+ * Rejects when Steam refuses the request, reports an error, or sends no answer in time.
1647
+ *
1648
+ * @param items - The item definitions to create, with their quantities.
1649
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1650
+ * @returns the items that Steam created.
1651
+ */
1652
+ export function generateItems(items: Array<ItemQuantity>, timeoutMs?: number | undefined | null): Promise<InventoryResultData>
1653
+ /**
1654
+ * Grants the promotional items the user is eligible for, once only. Resolves with the granted items.
1655
+ *
1656
+ * This changes the user's real inventory. Being eligible for no promotion still resolves, with an empty list.
1657
+ * Rejects when Steam reports an error or sends no answer in time.
1658
+ *
1659
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1660
+ * @returns the promotional items that were granted.
1661
+ */
1662
+ export function grantPromoItems(timeoutMs?: number | undefined | null): Promise<InventoryResultData>
1663
+ /**
1664
+ * Grants one promotional item definition, if the user is eligible for it. Resolves with the granted items.
1665
+ *
1666
+ * This changes the user's real inventory. Use `requestEligiblePromoItems()` to see which definitions can be granted.
1667
+ * Rejects when Steam refuses the grant, reports an error or sends no answer in time.
1668
+ *
1669
+ * @param definition - The promotional item definition id.
1670
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1671
+ * @returns the items that were granted.
1672
+ */
1673
+ export function addPromoItem(definition: number, timeoutMs?: number | undefined | null): Promise<InventoryResultData>
1674
+ /**
1675
+ * Grants several promotional item definitions, if the user is eligible for them. Only the listed definitions are checked.
1676
+ *
1677
+ * This changes the user's real inventory. Rejects when Steam refuses the grant, reports an error or sends no answer in time.
1678
+ *
1679
+ * @param definitions - The promotional item definition ids.
1680
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1681
+ * @returns the items that were granted.
1682
+ */
1683
+ export function addPromoItems(definitions: Array<number>, timeoutMs?: number | undefined | null): Promise<InventoryResultData>
1684
+ /**
1685
+ * Permanently removes items from the user's inventory. The items cannot be recovered. Resolves with the inventory after the change.
1686
+ *
1687
+ * This changes the user's real inventory and cannot be undone. Ask the user to confirm before calling it. Rejects when the id is invalid, Steam reports an error, or no answer arrives in time.
1688
+ *
1689
+ * @param itemId - The instance id of the item, as a `bigint`.
1690
+ * @param quantity - How many of the item to remove.
1691
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1692
+ * @returns the result, which holds the consumed item with its `ITEM_FLAG_CONSUMED` flag set.
1693
+ */
1694
+ export function consumeItem(itemId: bigint, quantity: number, timeoutMs?: number | undefined | null): Promise<InventoryResultData>
1695
+ /**
1696
+ * Atomically destroys some items and creates others, following the exchange recipe set in Steamworks (for example crafting or opening a chest). Resolves with the result.
1697
+ *
1698
+ * This changes the user's real inventory and cannot be undone. Steam fails the whole exchange when the items do not match a recipe. Ask the user to confirm before calling it.
1699
+ * Rejects when Steam refuses the exchange, reports an error or sends no answer in time.
1700
+ *
1701
+ * @param generate - The item definitions to create, with their quantities.
1702
+ * @param destroy - The owned items to use up, with their quantities.
1703
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1704
+ * @returns the result of the exchange, which holds the created items.
1705
+ */
1706
+ export function exchangeItems(generate: Array<ItemQuantity>, destroy: Array<ItemInstanceQuantity>, timeoutMs?: number | undefined | null): Promise<InventoryResultData>
1707
+ /**
1708
+ * Moves quantity between two stacks of the same item, or splits a stack into a new item when `destination` is `null`. Resolves with the result.
1709
+ *
1710
+ * This changes the user's real inventory. Only stackable items can be split or merged.
1711
+ * Rejects when Steam refuses the transfer, reports an error or sends no answer in time.
1712
+ *
1713
+ * @param source - The instance id of the stack to take quantity from, as a `bigint`.
1714
+ * @param quantity - How much to move.
1715
+ * @param destination - The instance id of the stack to add to, as a `bigint`, or `null` to split off a new item.
1716
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1717
+ * @returns the result of the transfer.
1718
+ */
1719
+ export function transferItemQuantity(source: bigint, quantity: number, destination?: bigint | undefined | null, timeoutMs?: number | undefined | null): Promise<InventoryResultData>
1720
+ /** Deprecated by Steam: sending a drop heartbeat is no longer required for playtime accounting. This does nothing that Steam still uses. */
1721
+ export function sendItemDropHeartbeat(): void
1722
+ /**
1723
+ * Turns playtime credit into an item drop from a drop list definition. Resolves with the result, which is empty when there is not enough playtime credit.
1724
+ *
1725
+ * This changes the user's real inventory. Only definitions marked as playtime item generators in Steamworks can drop. Players can modify their client, so do not use the definition to control rarity.
1726
+ * Rejects when Steam reports an error or sends no answer in time.
1727
+ *
1728
+ * @param dropListDefinition - The drop list definition id.
1729
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1730
+ * @returns the items that dropped, which may be none.
1731
+ */
1732
+ export function triggerItemDrop(dropListDefinition: number, timeoutMs?: number | undefined | null): Promise<InventoryResultData>
1733
+ /**
1734
+ * Deprecated by Steam: the SDK documents trading through the inventory as not supported. The call is wrapped for completeness and is expected to reject. Unverified against a live Steam client.
1735
+ *
1736
+ * If Steam does accept it, this changes the user's real inventory by trading items with `partner`.
1737
+ *
1738
+ * @param partner - The Steam id of the trade partner, as a `bigint`.
1739
+ * @param give - The items the user gives, with their quantities.
1740
+ * @param get - The items the user receives, with their quantities.
1741
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1742
+ * @returns the result of the trade.
1743
+ */
1744
+ export function tradeItems(partner: bigint, give: Array<ItemInstanceQuantity>, get: Array<ItemInstanceQuantity>, timeoutMs?: number | undefined | null): Promise<InventoryResultData>
1745
+ /**
1746
+ * Starts loading and refreshing the item definitions. Returns `false` when the load cannot start.
1747
+ *
1748
+ * The definitions are complete only after Steam's definition update callback, so read `getItemDefinitions()` after that, not right after this call. Read-only.
1749
+ *
1750
+ * @returns `true` when the load started, otherwise `false`.
1751
+ */
1752
+ export function loadItemDefinitions(): boolean
1753
+ /**
1754
+ * Returns the ids of all item definitions set up in Steamworks. Returns `null` when Steam refuses the call, for example before the definitions are loaded.
1755
+ *
1756
+ * Read-only. The ids are not necessarily contiguous.
1757
+ *
1758
+ * @returns the item definition ids.
1759
+ */
1760
+ export function getItemDefinitionIds(): Array<number> | null
1761
+ /**
1762
+ * Returns every item definition with all of its properties. Returns `null` when Steam refuses to list the ids.
1763
+ *
1764
+ * Read-only. It reads each definition's properties one by one, so call it once and keep the result. Run it after the definitions are loaded.
1765
+ *
1766
+ * @returns each definition id with a record of its properties.
1767
+ */
1768
+ export function getItemDefinitions(): Array<ItemDefinition> | null
1769
+ /**
1770
+ * Returns one string property of an item definition, or `null` when it is unknown or cannot be read.
1771
+ *
1772
+ * Read-only. Some properties, such as `name`, are localized for the current Steam language.
1773
+ *
1774
+ * @param definition - The item definition id.
1775
+ * @param name - The property name, made of ASCII letters, digits and underscores.
1776
+ * @returns the property value, or `null`.
1777
+ */
1778
+ export function getItemDefinitionProperty(definition: number, name: string): string | null
1779
+ /**
1780
+ * Asks Steam which promotional item definitions the user can be granted manually. Resolves with their ids.
1781
+ *
1782
+ * Read-only: this does not change the inventory. Grant one of them with `addPromoItem()`.
1783
+ * Rejects when Steam reports an error or sends no answer in time.
1784
+ *
1785
+ * @param steamId - The 64-bit Steam id of the user, as a `bigint`.
1786
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1787
+ * @returns the eligible item definition ids and whether they came from the cache.
1788
+ */
1789
+ export function requestEligiblePromoItems(steamId: bigint, timeoutMs?: number | undefined | null): Promise<EligiblePromoItems>
1790
+ /**
1791
+ * Starts buying item definitions. Resolves with the order and transaction ids once Steam has opened the purchase.
1792
+ *
1793
+ * This is a real purchase that charges the user. The user confirms it in the Steam overlay; the final purchase result arrives later as Steam's result-ready callback, not through this promise.
1794
+ * Rejects when Steam cannot start the transaction, reports an error or sends no answer in time.
1795
+ *
1796
+ * @param items - The item definitions to buy, with their quantities.
1797
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1798
+ * @returns the order id and transaction id Steam assigned.
1799
+ */
1800
+ export function startPurchase(items: Array<ItemQuantity>, timeoutMs?: number | undefined | null): Promise<PurchaseStarted>
1801
+ /**
1802
+ * Asks Steam for the current prices of the item definitions. Resolves with the currency of the prices.
1803
+ *
1804
+ * Read-only. Call it before `getItemsWithPrices()` or `getItemPrice()`.
1805
+ * Rejects when Steam reports an error or sends no answer in time.
1806
+ *
1807
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1808
+ * @returns the currency code of the prices.
1809
+ */
1810
+ export function requestPrices(timeoutMs?: number | undefined | null): Promise<PricesReceived>
1811
+ /**
1812
+ * Returns how many item definitions have a price. Call `requestPrices()` first.
1813
+ *
1814
+ * Read-only. Returns `0` before the prices are requested.
1815
+ *
1816
+ * @returns the number of item definitions with a price.
1817
+ */
1818
+ export function getNumItemsWithPrices(): number
1819
+ /**
1820
+ * Returns the prices of all item definitions that have one. Returns `null` when Steam refuses to list them, for example before `requestPrices()` completes.
1821
+ *
1822
+ * Read-only. Prices are in the smallest unit of the currency from `requestPrices()`.
1823
+ *
1824
+ * @returns the price of each item definition that has one.
1825
+ */
1826
+ export function getItemsWithPrices(): Array<ItemPrice> | null
1827
+ /**
1828
+ * Returns the price of one item definition. Returns `null` when Steam stores no price for it.
1829
+ *
1830
+ * Read-only. Call `requestPrices()` first.
1831
+ *
1832
+ * @param definition - The item definition id.
1833
+ * @returns the current and base price, or `null`.
1834
+ */
1835
+ export function getItemPrice(definition: number): ItemPrice | null
1836
+ /**
1837
+ * Starts a batch of item property changes. Returns `null` when Steam refuses to start one.
1838
+ *
1839
+ * Add changes with the set and remove methods, then send the batch with `submit()`. Nothing changes until `submit()` resolves.
1840
+ *
1841
+ * @returns a new property update batch, or `null`.
1842
+ */
1843
+ export function startUpdateProperties(): InventoryPropertyUpdate | null
1844
+ /**
1845
+ * Asks Steam to fetch the item described by an inspection token, such as one from an item link. Resolves with the item.
1846
+ *
1847
+ * Read-only. Rejects when the token is invalid, Steam reports an error or sends no answer in time.
1848
+ *
1849
+ * @param token - The inspection token, as text.
1850
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1851
+ * @returns the inspected item.
485
1852
  */
486
- export function getAnalogAction(actionName: string): bigint
487
- /** Shuts down Steam Input. Call `init` again before using controllers or actions after this. */
488
- export function shutdown(): void
489
- export interface DigitalActionData {
490
- /** `true` while the digital action is pressed. */
491
- state: boolean
492
- /** `false` when the action is not available for this controller. */
493
- active: boolean
494
- }
495
- export interface AnalogActionData {
496
- x: number
497
- y: number
498
- /** `false` when the action is not available for this controller. */
499
- active: boolean
500
- }
1853
+ export function inspectItem(token: string, timeoutMs?: number | undefined | null): Promise<InventoryResultData>
501
1854
  /**
502
- * @param controllerHandle - a controller handle from `getConnectedControllers`
503
- * @param actionHandle - a digital action handle from `getDigitalAction`
1855
+ * A batch of item property changes. Create it with `startUpdateProperties()`, add changes with the set and
1856
+ * remove methods, then send it with `submit()`. Nothing changes until `submit()` resolves.
504
1857
  */
505
- export function getDigitalActionData(controllerHandle: bigint, actionHandle: bigint): DigitalActionData
506
- /** @param actionHandle - an analog action handle from `getAnalogAction` */
507
- export function getAnalogActionData(controllerHandle: bigint, actionHandle: bigint): AnalogActionData
508
- /** @returns the Steam action origins (numeric `EInputActionOrigin` values) bound to a digital action; empty when unbound */
509
- export function getDigitalActionOrigins(controllerHandle: bigint, actionSetHandle: bigint, actionHandle: bigint): Array<number>
510
- /** @returns the Steam action origins (numeric `EInputActionOrigin` values) bound to an analog action; empty when unbound */
511
- export function getAnalogActionOrigins(controllerHandle: bigint, actionSetHandle: bigint, actionHandle: bigint): Array<number>
512
- /** @returns the display name of an action origin, such as "A Button"; empty for an unknown origin */
513
- export function getStringForActionOrigin(origin: number): string
514
- /** @returns the glyph image path of an action origin */
515
- export function getGlyphForActionOrigin(origin: number): string
516
- export class Controller {
1858
+ export class InventoryPropertyUpdate {
517
1859
  /**
518
- * Switches this controller to an action set. The call is cheap and can be repeated safely.
519
- * @param actionSetHandle - action set handle from `getActionSet`
1860
+ * Sets a string property on an item in this batch. Throws when Steam refuses it, when the batch was already submitted, or when the name or value contains a NUL character.
1861
+ *
1862
+ * Nothing changes until `submit()` resolves.
1863
+ *
1864
+ * @param itemId - The instance id of the item, as a `bigint`.
1865
+ * @param name - The property name, made of ASCII letters, digits and underscores.
1866
+ * @param value - The new string value.
520
1867
  */
521
- activateActionSet(actionSetHandle: bigint): void
1868
+ setString(itemId: bigint, name: string, value: string): void
522
1869
  /**
523
- * Checks whether a digital action is pressed on this controller.
524
- * @param actionHandle - digital action handle from `getDigitalAction`
525
- * @returns `true` while the action is pressed, otherwise `false`
1870
+ * Sets a boolean property on an item in this batch. Throws when Steam refuses it, when the batch was already submitted, or when the name contains a NUL character.
1871
+ *
1872
+ * @param itemId - The instance id of the item, as a `bigint`.
1873
+ * @param name - The property name, made of ASCII letters, digits and underscores.
1874
+ * @param value - The new boolean value.
526
1875
  */
527
- isDigitalActionPressed(actionHandle: bigint): boolean
1876
+ setBool(itemId: bigint, name: string, value: boolean): void
528
1877
  /**
529
- * Reads the current vector of an analog action on this controller.
530
- * @param actionHandle - analog action handle from `getAnalogAction`
531
- * @returns `x` and `y` as reported by Steam Input. Unverified against a live Steam client: the value ranges are not checked here.
1878
+ * Sets a 64-bit integer property on an item in this batch. Throws when Steam refuses it, when the batch was already submitted, or when the name contains a NUL character.
1879
+ *
1880
+ * @param itemId - The instance id of the item, as a `bigint`.
1881
+ * @param name - The property name, made of ASCII letters, digits and underscores.
1882
+ * @param value - The new value, as a `bigint` between -2^63 and 2^63 - 1.
532
1883
  */
533
- getAnalogActionVector(actionHandle: bigint): AnalogActionVector
1884
+ setInt64(itemId: bigint, name: string, value: bigint): void
534
1885
  /**
535
- * Identifies the type of this controller.
536
- * @returns the controller's `InputType`, `Unknown` when Steam cannot identify it
1886
+ * Sets a float property on an item in this batch. Throws when Steam refuses it, when the batch was already submitted, or when the name contains a NUL character.
1887
+ *
1888
+ * The value is stored as a 32-bit float, so precision beyond about seven digits is lost.
1889
+ *
1890
+ * @param itemId - The instance id of the item, as a `bigint`.
1891
+ * @param name - The property name, made of ASCII letters, digits and underscores.
1892
+ * @param value - The new value.
537
1893
  */
538
- getType(): InputType
1894
+ setFloat(itemId: bigint, name: string, value: number): void
539
1895
  /**
540
- * Returns the Steam Input handle of this controller.
541
- * @returns the handle as a BigInt, the value used by controller-scoped Steam Input calls
1896
+ * Removes a property from an item in this batch. Throws when Steam refuses it, when the batch was already submitted, or when the name contains a NUL character.
1897
+ *
1898
+ * @param itemId - The instance id of the item, as a `bigint`.
1899
+ * @param name - The property name to remove.
542
1900
  */
543
- getHandle(): bigint
1901
+ remove(itemId: bigint, name: string): void
1902
+ /**
1903
+ * Sends the batch to Steam and changes the item properties of the user's real inventory. This cannot be undone. Resolves with the updated items.
1904
+ *
1905
+ * The batch can be submitted only once. Rejects when the batch was already submitted, when Steam refuses it, reports an error, or sends no answer in time. After a timeout the outcome is unknown, so check the inventory before retrying.
1906
+ *
1907
+ * @param timeoutMs - How long to wait for Steam, in milliseconds. Defaults to 30000.
1908
+ * @returns the items after the change, as Steam returns them.
1909
+ */
1910
+ submit(timeoutMs?: number | undefined | null): Promise<InventoryResultData>
544
1911
  }
545
1912
  }
546
1913
  export declare namespace leaderboard {
@@ -611,9 +1978,131 @@ export declare namespace leaderboard {
611
1978
  * @param maxDetails - maximum number of detail integers returned per entry
612
1979
  */
613
1980
  downloadEntries(request: LeaderboardDataRequest, start: number, end: number, maxDetails: number): Promise<Array<LeaderboardEntry>>
1981
+ /**
1982
+ * Attaches a piece of cloud content to the local user's entry on this leaderboard. This changes the user's leaderboard data on Steam.
1983
+ * @param ugcHandle - the UGC handle of the content, as a BigInt (for example the value returned by `cloud.shareFile()`)
1984
+ * @returns resolves when Steam accepts the attachment; rejects with Steam's error otherwise, or when the handle is not a valid 64-bit value
1985
+ */
1986
+ attachUgc(ugcHandle: bigint): Promise<void>
1987
+ /**
1988
+ * Downloads the leaderboard entries of the given users only. A user with no entry on this leaderboard is left out of the result.
1989
+ * Steam accepts at most 100 users per request and only one such request at a time; this binding rejects more than 100 before it calls Steam.
1990
+ * @param steamIds64 - the users' 64-bit SteamIDs, at most 100
1991
+ * @param maxDetails - maximum number of detail integers returned per entry
1992
+ * @returns the entries Steam returns, in Steam's order
1993
+ */
1994
+ downloadEntriesForUsers(steamIds64: Array<bigint>, maxDetails: number): Promise<Array<LeaderboardEntry>>
614
1995
  }
615
1996
  }
616
1997
  export declare namespace localplayer {
1998
+ /** Result of a voice call, from Steam's `EVoiceResult`. The values are the SDK numbers. */
1999
+ export const enum VoiceResult {
2000
+ Ok = 0,
2001
+ NotInitialized = 1,
2002
+ /** Voice is not recording. `getVoice()` returns this once a stopped recording has no audio left. */
2003
+ NotRecording = 2,
2004
+ NoData = 3,
2005
+ /** The destination buffer is too small. */
2006
+ BufferTooSmall = 4,
2007
+ DataCorrupted = 5,
2008
+ Restricted = 6,
2009
+ UnsupportedCodec = 7,
2010
+ ReceiverOutOfDate = 8,
2011
+ ReceiverDidNotAnswer = 9,
2012
+ /** A value this binding does not name. */
2013
+ Unknown = -1
2014
+ }
2015
+ /** Playtime progress for duration control, from Steam's `EDurationControlProgress`. `Half` and `NoProgress` are deprecated in the SDK. */
2016
+ export const enum DurationControlProgress {
2017
+ /** Full progress. */
2018
+ Full = 0,
2019
+ /** Deprecated: XP or persistent rewards should be halved. */
2020
+ Half = 1,
2021
+ /** Deprecated: XP or persistent rewards should be stopped. */
2022
+ NoProgress = 2,
2023
+ /** The allowed 3 hours since the 5-hour gap have passed; the game should exit. */
2024
+ ExitSoon3h = 3,
2025
+ /** The allowed 5 hours in the calendar day have passed; the game should exit. */
2026
+ ExitSoon5h = 4,
2027
+ /** The game runs after the day period; it should exit. */
2028
+ ExitSoonNight = 5,
2029
+ /** A value this binding does not name. */
2030
+ Unknown = -1
2031
+ }
2032
+ /** Which duration control notification timer expired, from Steam's `EDurationControlNotification`. `ThreeHours`, `HalfProgress` and `NoProgress` are deprecated in the SDK. */
2033
+ export const enum DurationControlNotification {
2034
+ /** Progress information only; there is nothing to show. */
2035
+ NoNotification = 0,
2036
+ /** The user has been playing for an hour. */
2037
+ OneHour = 1,
2038
+ /** Deprecated: the user has been playing for 3 hours. */
2039
+ ThreeHours = 2,
2040
+ /** Deprecated: progress is half normal. */
2041
+ HalfProgress = 3,
2042
+ /** Deprecated: progress is zero. */
2043
+ NoProgress = 4,
2044
+ /** The allowed 3 hours since the 5-hour gap have passed; the game should exit. */
2045
+ ExitSoon3h = 5,
2046
+ /** The allowed 5 hours in the calendar day have passed; the game should exit. */
2047
+ ExitSoon5h = 6,
2048
+ /** The game runs after the day period; it should exit. */
2049
+ ExitSoonNight = 7,
2050
+ /** A value this binding does not name. */
2051
+ Unknown = -1
2052
+ }
2053
+ /** The online state of the game for duration control, from Steam's `EDurationControlOnlineState`. */
2054
+ export const enum DurationControlOnlineState {
2055
+ /** Offline play: single player, offline co-op and the like. Offline time does not count against playtime limits. */
2056
+ Offline = 1,
2057
+ /** Currently in online play. */
2058
+ Online = 2,
2059
+ /** Currently in online play and asking not to be interrupted. */
2060
+ OnlineHighPri = 3
2061
+ }
2062
+ /** Result of `getAvailableVoice()`. */
2063
+ export interface VoiceAvailable {
2064
+ /** `Ok` when the byte count is valid; otherwise the reason it is not. */
2065
+ result: VoiceResult
2066
+ /** Compressed bytes that `getVoice()` can return now. `0` when the result is not `Ok`. */
2067
+ compressedBytes: number
2068
+ }
2069
+ /** Result of `getVoice()` or `decompressVoice()`. */
2070
+ export interface VoiceChunk {
2071
+ /** The SDK result. */
2072
+ result: VoiceResult
2073
+ /** The bytes read or decoded. Empty unless `result` is `Ok` (or `NoData`/`BufferTooSmall`, which carry no data). */
2074
+ data: Buffer
2075
+ }
2076
+ /** Community Market status of the logged-in user, from Steam's `MarketEligibilityResponse_t`. */
2077
+ export interface MarketEligibility {
2078
+ /** Whether the user may use the Community Market. */
2079
+ allowed: boolean
2080
+ /** Bit flags of the reasons the user may not use the Market (SDK `EMarketNotAllowedReasonFlags`), `0` when allowed. Bit values: 1 temporary failure, 2 account disabled, 4 account locked down, 8 account limited, 16 trade banned, 32 account not trusted, 64 Steam Guard not enabled, 128 Steam Guard only recently enabled, 256 recent password reset, 512 new payment method, 1024 invalid cookie, 2048 using a new device, 4096 recent self refund, 8192 new payment method cannot be verified, 16384 no recent purchases, 32768 accepted wallet gift. */
2081
+ notAllowedReasons: number
2082
+ /** The time from which the user may use the Market, as the SDK's `RTime32` in seconds. The header names only the type, so the epoch is unverified against a live Steam client. */
2083
+ allowedAtTime: number
2084
+ /** Days of Steam Guard the user must have had before using the Market. */
2085
+ steamGuardRequiredDays: number
2086
+ /** Days after first authorizing a device before the user may use the Market on that device. */
2087
+ newDeviceCooldownDays: number
2088
+ }
2089
+ /** Duration control (playtime limit) status of the logged-in user, from Steam's `DurationControl_t`. */
2090
+ export interface DurationControl {
2091
+ /** The app that generated the playtime. */
2092
+ appId: number
2093
+ /** Whether duration control applies to this user and game. */
2094
+ applicable: boolean
2095
+ /** Playtime since the most recent 5-hour gap, in seconds, counted up to the regulatory limit. */
2096
+ secondsLast5H: number
2097
+ /** The recommended progress. */
2098
+ progress: DurationControlProgress
2099
+ /** The notification to show, if any. Always `NoNotification` for this call. */
2100
+ notification: DurationControlNotification
2101
+ /** Playtime on the current calendar day, in seconds. */
2102
+ secondsToday: number
2103
+ /** Playtime left before the user reaches a regulatory limit, in seconds. */
2104
+ secondsRemaining: number
2105
+ }
617
2106
  /**
618
2107
  * Returns the SteamID of the logged-in local user. Requires a running, logged-in Steam client.
619
2108
  * @returns `steamId64` as a BigInt, `steamId32` as a string, and `accountId`
@@ -637,6 +2126,117 @@ export declare namespace localplayer {
637
2126
  * @param value - value to set; `null` or omitted removes the key
638
2127
  */
639
2128
  export function setRichPresence(key: string, value?: string | undefined | null): void
2129
+ /**
2130
+ * Returns the raw `HSteamUser` handle, the 32-bit value the SDK uses internally. Most code does not need it. Needs `init()`.
2131
+ * @returns the handle as a number.
2132
+ */
2133
+ export function getHSteamUser(): number
2134
+ /**
2135
+ * Reports a legacy usage event for a game to the Steam client. Needs `init()`. Only a few games use this call.
2136
+ * This sends data to Steam. The SDK header does not list the event numbers, so `event` is passed through unchanged; the mapping is unverified against a live Steam client.
2137
+ * Throws when `extraInfo` contains a NUL character, and then nothing is sent.
2138
+ * @param gameId - the raw `CGameID` as a BigInt; for a game without mods it is the app id.
2139
+ * @param event - the event number.
2140
+ * @param extraInfo - optional text sent with the event; empty when omitted.
2141
+ */
2142
+ export function trackAppUsageEvent(gameId: bigint, event: number, extraInfo?: string | undefined | null): void
2143
+ /**
2144
+ * Returns the local folder that Steam provides for the current account's data for this app, such as save games and configs. Needs `init()`.
2145
+ * @returns the folder path, or `null` when Steam returns none. The path form is the one in the SDK header: the Steam install folder, then `userdata`, the SteamID, the AppID and `local`, joined with the platform's path separator.
2146
+ */
2147
+ export function getUserDataFolder(): string | null
2148
+ /** Starts capturing voice from the microphone. Read the captured audio with `getVoice()` at least once per frame. Needs `init()`. */
2149
+ export function startVoiceRecording(): void
2150
+ /** Stops capturing voice. Steam keeps recording for a short time after this call, so keep calling `getVoice()` until its result is `VoiceResult.NotRecording`. */
2151
+ export function stopVoiceRecording(): void
2152
+ /**
2153
+ * Returns how many bytes of compressed voice data `getVoice()` can return now. Only compressed audio is used; the SDK's uncompressed (deprecated) output is never requested. Needs `init()`.
2154
+ * @returns `result`, and `compressedBytes`, which is `0` when the result is not `Ok`.
2155
+ */
2156
+ export function getAvailableVoice(): VoiceAvailable
2157
+ /**
2158
+ * Reads the compressed voice data captured since the last call. The buffer is sized from `getAvailableVoice()`, so the call returns what is available now. Needs `init()`.
2159
+ * Resolves with `result` and `data`. When `getAvailableVoice()` reports a result other than `Ok`, that result is returned with empty data. Throws only if the captured data is larger than 4 GB.
2160
+ * @returns `result`, and `data`, a Buffer of compressed bytes.
2161
+ */
2162
+ export function getVoice(): VoiceChunk
2163
+ /**
2164
+ * Decodes compressed voice data from `getVoice()` into raw single-channel 16-bit PCM. Needs `init()`.
2165
+ * The output buffer starts at 20 KB and is enlarged once when Steam asks for more room. The SDK supports sample rates from 11025 to 48000.
2166
+ * Throws when the input is larger than 4 GB.
2167
+ * @param compressed - the compressed voice bytes.
2168
+ * @param sampleRate - the output sample rate; `getVoiceOptimalSampleRate()` returns the decoder's native rate.
2169
+ * @returns `result`, and `data`, the decoded PCM bytes. The data is empty unless `result` is `Ok`.
2170
+ */
2171
+ export function decompressVoice(compressed: Buffer, sampleRate: number): VoiceChunk
2172
+ /**
2173
+ * Returns the native sample rate of the Steam voice decoder. Decoding at this rate does the least work; your audio output's own rate (often 44100 or 48000) can sound better. Needs `init()`.
2174
+ * @returns the sample rate in Hz.
2175
+ */
2176
+ export function getVoiceOptimalSampleRate(): number
2177
+ /**
2178
+ * Returns whether Steam thinks the logged-in user is behind a NAT device. Needs a connection to Steam (a `SteamServersConnected` callback has fired) and may not detect every form of NAT.
2179
+ * @returns true if Steam reports NAT, otherwise false.
2180
+ */
2181
+ export function isBehindNat(): boolean
2182
+ /**
2183
+ * Publishes a game server's address so friends can join this game. Steam replicates the data to friends. Needs `init()`.
2184
+ * This sends data to Steam. `ip` is passed as the 32-bit value of the IPv4 address (first octet in the highest byte). The header does not say which byte order the SDK expects, so this mapping is unverified against a live Steam client.
2185
+ * Throws when `gameServerSteamId` is not a valid BigInt or `ip` is not an IPv4 address.
2186
+ * @param gameServerSteamId - the game server's SteamID as a BigInt.
2187
+ * @param ip - the IPv4 address of the game server, such as "192.168.1.10".
2188
+ * @param port - the game server's port.
2189
+ */
2190
+ export function advertiseGame(gameServerSteamId: bigint, ip: string, port: number): void
2191
+ /**
2192
+ * Returns the logged-in user's trading-card badge level for a series. Needs `init()`.
2193
+ * The regular badge has a maximum level of 5 and the foil badge a maximum of 1 (from the SDK header). The header does not say which value means "no badge", so the value is passed through unverified.
2194
+ * @param series - the card series number.
2195
+ * @param foil - true for the foil badge, false for the regular badge.
2196
+ * @returns the badge level as the SDK reports it.
2197
+ */
2198
+ export function getGameBadgeLevel(series: number, foil: boolean): number
2199
+ /**
2200
+ * Returns whether the logged-in user's phone number is verified. Needs `init()`.
2201
+ * @returns true if verified, otherwise false.
2202
+ */
2203
+ export function isPhoneVerified(): boolean
2204
+ /**
2205
+ * Returns whether the logged-in user has two-factor authentication enabled. Needs `init()`.
2206
+ * @returns true if enabled, otherwise false.
2207
+ */
2208
+ export function isTwoFactorEnabled(): boolean
2209
+ /**
2210
+ * Returns whether the logged-in user's phone number is an identifying one. Needs `init()`.
2211
+ * @returns true if identifying, otherwise false.
2212
+ */
2213
+ export function isPhoneIdentifying(): boolean
2214
+ /**
2215
+ * Returns whether the logged-in user's phone number is waiting for (re)verification. Needs `init()`.
2216
+ * @returns true if verification is required, otherwise false.
2217
+ */
2218
+ export function isPhoneRequiringVerification(): boolean
2219
+ /**
2220
+ * Asks Steam whether the logged-in user may use the Community Market. Needs `init()`. Resolves once Steam has answered;
2221
+ * the answer is driven by `runCallbacks()`, which `init()` already calls.
2222
+ * There is no timeout: if Steam never answers, the Promise stays pending.
2223
+ * @returns the eligibility, including the reason flags and the cooldown fields.
2224
+ */
2225
+ export function getMarketEligibility(): Promise<MarketEligibility>
2226
+ /**
2227
+ * Asks Steam for the duration control (playtime limit) status of the logged-in user. Needs `init()`. Resolves once Steam has answered;
2228
+ * the answer is driven by `runCallbacks()`, which `init()` already calls.
2229
+ * Rejects when Steam reports an error. There is no timeout: if Steam never answers, the Promise stays pending. The `progress` and `notification` values can be deprecated ones (see their enums).
2230
+ * @returns the duration control status for the current app.
2231
+ */
2232
+ export function getDurationControl(): Promise<DurationControl>
2233
+ /**
2234
+ * Tells Steam's duration control system whether the game is in offline or online play. Offline play does not count against the playtime limits. Needs `init()`.
2235
+ * This sends the state to Steam.
2236
+ * @param state - the current online state of the game.
2237
+ * @returns true if the SDK accepted the state, otherwise false.
2238
+ */
2239
+ export function setDurationControlOnlineState(state: DurationControlOnlineState): boolean
640
2240
  }
641
2241
  export declare namespace matchmaking {
642
2242
  export const enum LobbyType {
@@ -1152,6 +2752,211 @@ export declare namespace networkingUtils {
1152
2752
  export function getRelayNetworkStatus(): NetworkingAvailability
1153
2753
  /** Returns the detailed relay network status, including the network config and relay reachability. */
1154
2754
  export function getDetailedRelayNetworkStatus(): RelayNetworkStatus
2755
+ /** This host's position on Valve's network, from `getLocalPingLocation()`. */
2756
+ export interface LocalPingLocation {
2757
+ /** The location as text. Its format may change between SDK versions, so pass it only to the functions in this namespace, and do not parse it yourself. */
2758
+ location: string
2759
+ /** Age of the ping data in seconds. */
2760
+ ageSeconds: number
2761
+ }
2762
+ /** One Valve data center (POP), from `getPops()`. */
2763
+ export interface DataCenter {
2764
+ /** The data center ID, as Steam encodes it. */
2765
+ id: number
2766
+ /** Readable code of the data center, such as `iad`. Usually three or four characters. */
2767
+ code: string
2768
+ /** Best relayed ping in milliseconds, or `null` when Steam has no estimate. */
2769
+ ping?: number
2770
+ }
2771
+ /** The best relayed route to a data center, from `getPingToDataCenter()`. */
2772
+ export interface DataCenterRoute {
2773
+ /** Relayed ping in milliseconds. */
2774
+ pingMs: number
2775
+ /** The data center the route goes through, as its ID. */
2776
+ viaPop: number
2777
+ /** Readable code of `viaPop`. */
2778
+ viaCode: string
2779
+ }
2780
+ /** Classification of an address against Steam's fake IP range. The numbers are not Steam's codes; compare by name. */
2781
+ export const enum FakeIpType {
2782
+ /** The value is not an IP address. */
2783
+ Invalid = 0,
2784
+ /** A valid IP address outside the fake range. */
2785
+ NotFake = 1,
2786
+ /** A globally unique IPv4 address for this app, managed by Steam. */
2787
+ GlobalIpv4 = 2,
2788
+ /** A locally unique IPv4 address, managed by this process. Do not share it. */
2789
+ LocalIpv4 = 3
2790
+ }
2791
+ /** Description of a config value, from `getConfigValueInfo()`. */
2792
+ export interface ConfigValueInfo {
2793
+ /** The SDK name of the value, such as `TimeoutInitial`. */
2794
+ name: string
2795
+ /** Type of the value: `int32`, `int64`, `float`, `string`, or `callback` (a pointer that cannot be read from JavaScript). */
2796
+ dataType: string
2797
+ /** Scope the value can be set at: `global`, `socketsInterface`, `listenSocket` or `connection`. */
2798
+ scope: string
2799
+ }
2800
+ /**
2801
+ * Returns this host's position on Valve's network and the age of that data. Returns `null` when Steam has no ping data yet, which takes a few seconds after `initRelayNetworkAccess()`. Needs `init()`.
2802
+ * @returns The location text and the data age in seconds, or `null` when no data is available.
2803
+ */
2804
+ export function getLocalPingLocation(): LocalPingLocation | null
2805
+ /**
2806
+ * Parses ping location text, such as one shared by another player, and returns it in Steam's normalized text form. Needs `init()`.
2807
+ * @param location - The location text to check.
2808
+ * @returns The normalized text, or `null` when Steam does not understand the text.
2809
+ */
2810
+ export function parsePingLocation(location: string): string | null
2811
+ /**
2812
+ * Estimates the round-trip time between two ping locations, through the relay network. It does not send packets. Needs `init()`.
2813
+ * @param first - Location text from `getLocalPingLocation()` or `parsePingLocation()`.
2814
+ * @param second - The other location text.
2815
+ * @returns The estimate in milliseconds, or `null` when Steam cannot estimate it. Throws when either text is not understood.
2816
+ */
2817
+ export function estimatePingBetweenLocations(first: string, second: string): number | null
2818
+ /**
2819
+ * Estimates the round-trip time from this host to a ping location. Faster than `estimatePingBetweenLocations()` when you compare many locations. Needs `init()`.
2820
+ * @param remote - The remote location text.
2821
+ * @returns The estimate in milliseconds, or `null` when Steam cannot estimate it. Throws when the text is not understood.
2822
+ */
2823
+ export function estimatePingFromLocalHost(remote: string): number | null
2824
+ /**
2825
+ * Checks whether ping data at most `maxAgeSeconds` old exists. If it does not, Steam starts a new measurement and this returns `false`. Needs `init()`.
2826
+ * Only call it when you need a fresh measurement now, for example after a user request. Steam refreshes the data on its own.
2827
+ * @param maxAgeSeconds - The oldest acceptable age of the data, in seconds. Must be finite and not negative.
2828
+ * @returns `true` when recent enough data already exists.
2829
+ */
2830
+ export function checkPingDataUpToDate(maxAgeSeconds: number): boolean
2831
+ /**
2832
+ * Returns the best relayed route to a data center, with its ping and the data center the route uses. Needs `init()`.
2833
+ * @param pop - The data center ID, from `getPops()`.
2834
+ * @returns The route, or `null` when Steam has no estimate.
2835
+ */
2836
+ export function getPingToDataCenter(pop: number): DataCenterRoute | null
2837
+ /**
2838
+ * Returns the direct ping, without relaying, to the relays at a data center. Needs `init()`.
2839
+ * @param pop - The data center ID.
2840
+ * @returns The ping in milliseconds, or `null` when Steam has no estimate.
2841
+ */
2842
+ export function getDirectPingToPop(pop: number): number | null
2843
+ /** Returns the number of data centers (POPs) in the network config. Needs `init()`. */
2844
+ export function getPopCount(): number
2845
+ /**
2846
+ * Returns every data center in the network config, with its code and best relayed ping. Needs `init()`.
2847
+ * @returns One entry per data center. An empty array when the config lists none, or when Steam has not loaded it yet.
2848
+ */
2849
+ export function getPops(): Array<DataCenter>
2850
+ /**
2851
+ * Returns the local timestamp in microseconds. It never goes backwards, and it is only comparable within this run of the process. Needs `init()`.
2852
+ * @returns The timestamp as a BigInt.
2853
+ */
2854
+ export function getLocalTimestamp(): bigint
2855
+ /**
2856
+ * Returns `true` when an IPv4 address is in Steam's fake IP range. Needs `init()`.
2857
+ * @param ipv4 - The IPv4 address as the SDK's 32-bit number. Its byte order is unverified against a live Steam client.
2858
+ */
2859
+ export function isFakeIpv4(ipv4: number): boolean
2860
+ /**
2861
+ * Classifies an IPv4 address against the fake IP range. Needs `init()`.
2862
+ * @param ipv4 - The IPv4 address as the SDK's 32-bit number. Its byte order is unverified against a live Steam client.
2863
+ */
2864
+ export function getIpv4FakeIpType(ipv4: number): FakeIpType
2865
+ /**
2866
+ * Returns the real identity behind a fake IP address, as text. Steam keeps the mapping for active connections and for a short time after they close. Needs `init()`.
2867
+ * @param fakeIp - The fake address, as `ip` or `ip:port` text.
2868
+ * @returns The identity text. Throws with Steam's reason when the address is not a fake IP (InvalidParameter) or the mapping is unknown (NoMatch).
2869
+ */
2870
+ export function getRealIdentityForFakeIp(fakeIp: string): string
2871
+ /**
2872
+ * Formats an IP address in Steam's text form. Needs `init()`.
2873
+ * @param address - The address text, with or without a port.
2874
+ * @param withPort - Whether to include the port in the output.
2875
+ * @returns The formatted address. Throws when the text is not an IP address.
2876
+ */
2877
+ export function ipAddrToString(address: string, withPort: boolean): string
2878
+ /**
2879
+ * Parses an IP address and returns it in Steam's text form, with the port. Needs `init()`.
2880
+ * @param address - The address text.
2881
+ * @returns The normalized text, or `null` when Steam does not understand it.
2882
+ */
2883
+ export function parseIpAddr(address: string): string | null
2884
+ /**
2885
+ * Classifies an IP address against Steam's fake IP range. Needs `init()`.
2886
+ * @param address - The address text, with or without a port.
2887
+ * @returns The classification. Throws when the text is not an IP address.
2888
+ */
2889
+ export function getIpAddrFakeIpType(address: string): FakeIpType
2890
+ /**
2891
+ * Formats a networking identity (such as a SteamID or an IP address) in Steam's text form. Use it for logs and storage; do not parse the text yourself. Needs `init()`.
2892
+ * @param identity - The identity text.
2893
+ * @returns The formatted identity. Throws when the text is not an identity.
2894
+ */
2895
+ export function identityToString(identity: string): string
2896
+ /**
2897
+ * Parses a networking identity text and returns it in Steam's normalized form. Needs `init()`.
2898
+ * @param identity - The identity text.
2899
+ * @returns The normalized text, or `null` when Steam does not understand it.
2900
+ */
2901
+ export function parseIdentity(identity: string): string | null
2902
+ /**
2903
+ * Sets a global `int32` config value. Needs `init()`.
2904
+ * @param valueId - The config value number, from `getConfigValueInfo()` or `iterateGenericEditableConfigValues()`.
2905
+ * @returns `true` when Steam accepted the value, `false` when it refused it (for example the setting has another type).
2906
+ */
2907
+ export function setGlobalConfigValueInt32(valueId: number, value: number): boolean
2908
+ /**
2909
+ * Sets a global `float` config value. Needs `init()`.
2910
+ * @param valueId - The config value number.
2911
+ * @returns `true` when Steam accepted the value, `false` when it refused it.
2912
+ */
2913
+ export function setGlobalConfigValueFloat(valueId: number, value: number): boolean
2914
+ /**
2915
+ * Sets a global `string` config value. Needs `init()`.
2916
+ * @param valueId - The config value number.
2917
+ * @returns `true` when Steam accepted the value, `false` when it refused it. Throws when the text contains a NUL character.
2918
+ */
2919
+ export function setGlobalConfigValueString(valueId: number, value: string): boolean
2920
+ /**
2921
+ * Sets an `int32` config value on one connection. Needs `init()`.
2922
+ * The JavaScript `Connection` object does not expose its handle yet, so pass the raw `HSteamNetConnection` number from another source.
2923
+ * @param connection - The raw connection handle.
2924
+ * @returns `true` when Steam accepted the value, `false` when it refused it or the connection handle is invalid.
2925
+ */
2926
+ export function setConnectionConfigValueInt32(connection: number, valueId: number, value: number): boolean
2927
+ /**
2928
+ * Sets a `float` config value on one connection. Needs `init()`. See `setConnectionConfigValueInt32()` for the handle.
2929
+ * @param connection - The raw connection handle.
2930
+ * @returns `true` when Steam accepted the value, `false` otherwise.
2931
+ */
2932
+ export function setConnectionConfigValueFloat(connection: number, valueId: number, value: number): boolean
2933
+ /**
2934
+ * Sets a `string` config value on one connection. Needs `init()`. See `setConnectionConfigValueInt32()` for the handle.
2935
+ * @param connection - The raw connection handle.
2936
+ * @returns `true` when Steam accepted the value, `false` otherwise. Throws when the text contains a NUL character.
2937
+ */
2938
+ export function setConnectionConfigValueString(connection: number, valueId: number, value: string): boolean
2939
+ /**
2940
+ * Reads a config value, globally or for one connection. Needs `init()`.
2941
+ * The result is a number for `int32` and `float` values, a BigInt for `int64` values (so large values stay exact), and a string for `string` values.
2942
+ * @param valueId - The config value number.
2943
+ * @param connection - Optional raw connection handle. When given, the value is read for that connection, falling back to the inherited value.
2944
+ * @returns The value, or `null` when it does not exist, the connection is invalid, or the value is a callback.
2945
+ */
2946
+ export function getConfigValue(valueId: number, connection?: number | undefined | null): number | bigint | string | null
2947
+ /**
2948
+ * Returns the name, type and scope of a config value. Needs `init()`.
2949
+ * @param valueId - The config value number.
2950
+ * @returns The description, or `null` when the value does not exist.
2951
+ */
2952
+ export function getConfigValueInfo(valueId: number): ConfigValueInfo | null
2953
+ /**
2954
+ * Returns the next config value that a generic settings screen can edit. Pass `null` to start from the beginning. Needs `init()`.
2955
+ * @param current - The value returned by the previous call, or `null` to start.
2956
+ * @param includeDevVars - Whether to include development-only values. Keep it `false` in a shipped build.
2957
+ * @returns The next config value number, or `null` at the end of the list.
2958
+ */
2959
+ export function iterateGenericEditableConfigValues(current?: number | undefined | null, includeDevVars?: boolean | undefined | null): number | null
1155
2960
  }
1156
2961
  export declare namespace overlay {
1157
2962
  export const enum Dialog {
@@ -1288,6 +3093,65 @@ export declare namespace stats {
1288
3093
  export function getNumAchievements(): number | null
1289
3094
  /** Asks Steam to fetch another user's statistics. The result arrives later through the `UserStatsReceived` callback. */
1290
3095
  export function requestUserStats(steamId64: bigint): void
3096
+ /**
3097
+ * Reads an integer stat of another user. Needs `requestUserStats(steamId64)` to have completed for that user first.
3098
+ * @param steamId64 - the other user's 64-bit SteamID
3099
+ * @param name - stat name as defined in the Steamworks site
3100
+ * @returns the value, or `null` when the stat is missing, the user's stats are not loaded, or the SteamID is not a valid 64-bit value
3101
+ */
3102
+ export function getUserInt(steamId64: bigint, name: string): number | null
3103
+ /**
3104
+ * Reads a float stat of another user. Same requirements as `getUserInt()`.
3105
+ * @param steamId64 - the other user's 64-bit SteamID
3106
+ * @param name - stat name as defined in the Steamworks site
3107
+ * @returns the value, or `null` when the stat is missing, the user's stats are not loaded, or the SteamID is not a valid 64-bit value
3108
+ */
3109
+ export function getUserFloat(steamId64: bigint, name: string): number | null
3110
+ /**
3111
+ * Adds to an average-rate stat of the local user. The change is sent to Steam only after `store()`. Steam keeps the count as a 32-bit float, so very large counts lose precision.
3112
+ * @param name - stat name as defined in the Steamworks site
3113
+ * @param countThisSession - the amount accumulated in this session
3114
+ * @param sessionLength - the length of the session, in seconds
3115
+ * @returns `true` when Steam accepted the change, otherwise `false` (for example a name with a NUL character)
3116
+ */
3117
+ export function updateAvgRateStat(name: string, countThisSession: number, sessionLength: number): boolean
3118
+ /**
3119
+ * Asks Steam for the global stats of the game and the daily history of the last `historyDays` days. Resolves when Steam answers, which happens while `runCallbacks()` runs. Needs `init()`.
3120
+ * @param historyDays - days of daily history to fetch, from `0` to `60`
3121
+ * @returns the GameID Steam reports for the app; rejects when `historyDays` is above 60 or when Steam reports an error
3122
+ */
3123
+ export function requestGlobalStats(historyDays: number): Promise<bigint>
3124
+ /**
3125
+ * Reads a global integer stat. Needs `requestGlobalStats()` to have completed.
3126
+ * @param name - stat name as defined in the Steamworks site
3127
+ * @returns the value as a BigInt, or `null` when the stat is not defined or the global stats are not loaded
3128
+ */
3129
+ export function getGlobalInt(name: string): bigint | null
3130
+ /**
3131
+ * Reads a global float stat. Needs `requestGlobalStats()` to have completed.
3132
+ * @param name - stat name as defined in the Steamworks site
3133
+ * @returns the value, or `null` when the stat is not defined or the global stats are not loaded
3134
+ */
3135
+ export function getGlobalFloat(name: string): number | null
3136
+ /**
3137
+ * Reads the daily history of a global integer stat, newest day first. Needs `requestGlobalStats()` to have completed.
3138
+ * @param name - stat name as defined in the Steamworks site
3139
+ * @param days - number of days to read, from `0` to `60`, and at most the days asked for in `requestGlobalStats()`
3140
+ * @returns the daily values as BigInts, or `null` when the stat is unknown, the global stats are not loaded, or `days` is above 60
3141
+ */
3142
+ export function getGlobalIntHistory(name: string, days: number): Array<bigint> | null
3143
+ /**
3144
+ * Reads the daily history of a global float stat, newest day first. Same requirements as `getGlobalIntHistory()`.
3145
+ * @param name - stat name as defined in the Steamworks site
3146
+ * @param days - number of days to read, from `0` to `60`, and at most the days asked for in `requestGlobalStats()`
3147
+ * @returns the daily values, or `null` when the stat is unknown, the global stats are not loaded, or `days` is above 60
3148
+ */
3149
+ export function getGlobalFloatHistory(name: string, days: number): Array<number> | null
3150
+ /**
3151
+ * Asks Steam how many players are playing the game right now, online and offline. Resolves when Steam answers, which happens while `runCallbacks()` runs.
3152
+ * @returns the player count; rejects when Steam reports a failure
3153
+ */
3154
+ export function getNumberOfCurrentPlayers(): Promise<number>
1291
3155
  }
1292
3156
  export declare namespace timeline {
1293
3157
  export const enum TimelineGameMode {
@@ -1313,8 +3177,186 @@ export declare namespace timeline {
1313
3177
  * @param durationSeconds - how long the event lasts, must not be negative
1314
3178
  */
1315
3179
  export function addEvent(icon: string, title: string, description: string, priority: number, startOffsetSeconds: number, durationSeconds: number, clipPriority: TimelineEventClipPriority): void
3180
+ /** Result of `doesEventRecordingExist()`. */
3181
+ export interface EventRecordingExists {
3182
+ /** The event handle that was asked about. */
3183
+ event: bigint
3184
+ /** `true` when a background recording covers the event. */
3185
+ recordingExists: boolean
3186
+ }
3187
+ /** Result of `doesGamePhaseRecordingExist()`. */
3188
+ export interface GamePhaseRecordingExists {
3189
+ /** The phase ID, as Steam returns it. */
3190
+ phaseId: string
3191
+ /** Length in milliseconds of the background recording covering the phase. */
3192
+ recordingMs: number
3193
+ /** Length in milliseconds of the longest clip made from the phase. */
3194
+ longestClipMs: number
3195
+ /** Number of clips made from the phase. */
3196
+ clipCount: number
3197
+ /** Number of screenshots taken during the phase. */
3198
+ screenshotCount: number
3199
+ }
3200
+ /**
3201
+ * Adds an event that happens at one moment on the Steam timeline. Needs `init()`.
3202
+ * @param title - Title shown on the timeline, in the language from `getUiLanguage()`.
3203
+ * @param description - Description shown on the timeline, in the same language.
3204
+ * @param icon - Name of an icon uploaded for the app, or a built-in `steam_` icon.
3205
+ * @param iconPriority - Priority of the icon. Higher values are shown first.
3206
+ * @param startOffsetSeconds - Seconds from now at which the event happens. Negative for the past.
3207
+ * @param clipPriority - Whether the event makes a clip, and how important it is.
3208
+ * @returns The event handle, or `null` when the timeline is unavailable. Throws when a text contains a NUL character or the offset is not finite.
3209
+ */
3210
+ export function addInstantaneousTimelineEvent(title: string, description: string, icon: string, iconPriority: number, startOffsetSeconds: number, clipPriority: TimelineEventClipPriority): bigint | null
3211
+ /**
3212
+ * Starts a range event now (plus `startOffsetSeconds`). It lasts until `endRangeTimelineEvent()`. Needs `init()`.
3213
+ * Steam discards range events that are still open when the game exits.
3214
+ * @param title - Title shown on the timeline.
3215
+ * @param description - Description shown on the timeline.
3216
+ * @param icon - Name of an icon uploaded for the app, or a built-in `steam_` icon.
3217
+ * @param priority - Priority of the event.
3218
+ * @param startOffsetSeconds - Seconds from now at which the event starts. Negative for the past.
3219
+ * @param clipPriority - Whether the event makes a clip, and how important it is.
3220
+ * @returns The event handle, or `null` when the timeline is unavailable. Throws when a text contains a NUL character or the offset is not finite.
3221
+ */
3222
+ export function startRangeTimelineEvent(title: string, description: string, icon: string, priority: number, startOffsetSeconds: number, clipPriority: TimelineEventClipPriority): bigint | null
3223
+ /**
3224
+ * Changes the fields of a range event that has started and not ended. Needs `init()`.
3225
+ * Does nothing when the timeline is unavailable. Throws when the handle is not a BigInt from this API or a text contains a NUL character.
3226
+ * @param event - The handle from `startRangeTimelineEvent()`.
3227
+ */
3228
+ export function updateRangeTimelineEvent(event: bigint, title: string, description: string, icon: string, priority: number, clipPriority: TimelineEventClipPriority): void
3229
+ /**
3230
+ * Ends a range event, `endOffsetSeconds` from now, and shows it on the timeline. Needs `init()`.
3231
+ * Does nothing when the timeline is unavailable. Throws when the handle is not valid or the offset is not finite.
3232
+ * @param event - The handle from `startRangeTimelineEvent()`.
3233
+ * @param endOffsetSeconds - Seconds from now at which the event ends. Negative for the past.
3234
+ */
3235
+ export function endRangeTimelineEvent(event: bigint, endOffsetSeconds: number): void
3236
+ /**
3237
+ * Removes an event from the timeline. Works for instantaneous and range events. Needs `init()`.
3238
+ * Does nothing when the timeline is unavailable. Throws when the handle is not valid.
3239
+ * @param event - The event handle.
3240
+ */
3241
+ export function removeTimelineEvent(event: bigint): void
3242
+ /**
3243
+ * Asks whether a background recording covers an event. Needs `init()`.
3244
+ * The promise resolves when Steam answers, which happens during `runCallbacks()`, so keep calling it while the promise is pending.
3245
+ * @param event - The event handle.
3246
+ * @returns The answer, with the handle again. Rejects when the timeline is unavailable or Steam cannot answer (for example a disk I/O failure).
3247
+ */
3248
+ export function doesEventRecordingExist(event: bigint): Promise<EventRecordingExists>
3249
+ /**
3250
+ * Starts a game phase, which ends the previous one. A phase is a stretch of play of about 10 minutes to a few hours, such as one match or one chapter. Needs `init()`.
3251
+ * Does nothing when the timeline is unavailable.
3252
+ */
3253
+ export function startGamePhase(): void
3254
+ /** Ends the current game phase. Needs `init()`. Does nothing when the timeline is unavailable. */
3255
+ export function endGamePhase(): void
3256
+ /**
3257
+ * Sets the ID of the current game phase, so `openOverlayToGamePhase()` and `doesGamePhaseRecordingExist()` can find it. Needs `init()`.
3258
+ * Does nothing when the timeline is unavailable. Throws when the ID is longer than 63 bytes or contains a NUL character.
3259
+ * @param phaseId - The phase ID. Use a stable value you can look up later.
3260
+ */
3261
+ export function setGamePhaseId(phaseId: string): void
3262
+ /**
3263
+ * Asks whether a background recording covers a game phase. Needs `init()`.
3264
+ * The promise resolves when Steam answers, which happens during `runCallbacks()`, so keep calling it while the promise is pending.
3265
+ * @param phaseId - The phase ID set with `setGamePhaseId()`.
3266
+ * @returns The recording and clip lengths in milliseconds, and the clip and screenshot counts. Rejects when the timeline is unavailable, the ID is not valid, or Steam cannot answer.
3267
+ */
3268
+ export function doesGamePhaseRecordingExist(phaseId: string): Promise<GamePhaseRecordingExists>
3269
+ /**
3270
+ * Adds a tag that applies to the whole current game phase. Several tags of one group are all kept. Needs `init()`.
3271
+ * Does nothing when the timeline is unavailable. Throws when a text contains a NUL character.
3272
+ * @param tagName - Localized tag text.
3273
+ * @param tagIcon - Name of an icon.
3274
+ * @param tagGroup - Localized group name the tag belongs to.
3275
+ * @param priority - Priority of the tag.
3276
+ */
3277
+ export function addGamePhaseTag(tagName: string, tagIcon: string, tagGroup: string, priority: number): void
3278
+ /**
3279
+ * Sets a text attribute for the whole current game phase, such as a score. Only the last value set is shown. Needs `init()`.
3280
+ * Does nothing when the timeline is unavailable. Throws when a text contains a NUL character.
3281
+ * @param attributeGroup - Localized name of the attribute.
3282
+ * @param attributeValue - The value to show.
3283
+ * @param priority - Priority of the attribute.
3284
+ */
3285
+ export function setGamePhaseAttribute(attributeGroup: string, attributeValue: string, priority: number): void
3286
+ /**
3287
+ * Opens the Steam overlay on a game phase that has an ID set with `setGamePhaseId()`. Needs `init()`.
3288
+ * Does nothing when the timeline is unavailable. Throws when the ID is too long or contains a NUL character.
3289
+ * @param phaseId - The phase ID.
3290
+ */
3291
+ export function openOverlayToGamePhase(phaseId: string): void
3292
+ /**
3293
+ * Opens the Steam overlay on a timeline event. Needs `init()`.
3294
+ * Does nothing when the timeline is unavailable. Throws when the handle is not valid.
3295
+ * @param event - The event handle.
3296
+ */
3297
+ export function openOverlayToTimelineEvent(event: bigint): void
1316
3298
  }
1317
3299
  export declare namespace utils {
3300
+ /** The Steam universe a client connects to. The numbers match `EUniverse`. */
3301
+ export const enum Universe {
3302
+ /** Not set. */
3303
+ Invalid = 0,
3304
+ /** The public Steam universe. */
3305
+ Public = 1,
3306
+ /** The beta universe. */
3307
+ Beta = 2,
3308
+ /** The internal Valve universe. */
3309
+ Internal = 3,
3310
+ /** The development universe. */
3311
+ Dev = 4
3312
+ }
3313
+ /** The verdict of `checkFileSignature`. The numbers match `ECheckFileSignature`. */
3314
+ export const enum FileSignatureStatus {
3315
+ /** The file is not signed, or the signature does not match. */
3316
+ InvalidSignature = 0,
3317
+ /** The file is signed and the signature is valid. */
3318
+ ValidSignature = 1,
3319
+ /** The file does not exist on disk. */
3320
+ FileNotFound = 2,
3321
+ /** The app has no signing set on the partner site. */
3322
+ NoSignaturesFoundForThisApp = 3,
3323
+ /** The file is not listed in the signing set on the partner site. */
3324
+ NoSignaturesFoundForThisFile = 4
3325
+ }
3326
+ /** The protocol to test with `getIpv6ConnectivityState`. The numbers match `ESteamIPv6ConnectivityProtocol`. */
3327
+ export const enum Ipv6Protocol {
3328
+ /** HTTP, which can differ from the other protocols when a proxy is in use. */
3329
+ Http = 1,
3330
+ /** UDP on a port Steam also uses. If UDP works, TCP probably works too. */
3331
+ Udp = 2
3332
+ }
3333
+ /** IPv6 connectivity state of this machine. The numbers match `ESteamIPv6ConnectivityState`. */
3334
+ export const enum Ipv6ConnectivityState {
3335
+ /** No test has run yet. */
3336
+ Unknown = 0,
3337
+ /** A recent IPv6 request succeeded. */
3338
+ Good = 1,
3339
+ /** A request failed: no IPv6 address, or no upstream connectivity. */
3340
+ Bad = 2
3341
+ }
3342
+ /** The kind of text given to `filterText`. The numbers match `ETextFilteringContext`. */
3343
+ export const enum TextFilteringContext {
3344
+ /** Unknown context. */
3345
+ Unknown = 0,
3346
+ /** Game content: only the legally required filtering is applied. */
3347
+ GameContent = 1,
3348
+ /** Chat from another player. */
3349
+ Chat = 2,
3350
+ /** A character or item name. */
3351
+ Name = 3
3352
+ }
3353
+ /** The output of `filterText`. */
3354
+ export interface FilteredText {
3355
+ /** The filtered message, as UTF-8. */
3356
+ text: string
3357
+ /** The number of characters the filter changed, as the SDK reports it. */
3358
+ filteredCount: number
3359
+ }
1318
3360
  /**
1319
3361
  * Returns the AppID of the running game.
1320
3362
  * @returns the AppID
@@ -1354,6 +3396,90 @@ export declare namespace utils {
1354
3396
  export function isSteamInBigPictureMode(): boolean
1355
3397
  /** @returns the language code of the Steam UI, for example `english` or `schinese` */
1356
3398
  export function getUiLanguage(): string
3399
+ /**
3400
+ * Returns the seconds since the user was last active in the game. The SDK header does not define "active" any further; unverified against a live Steam client.
3401
+ * @returns the number of seconds, as an unsigned 32-bit integer
3402
+ */
3403
+ export function getSecondsSinceAppActive(): number
3404
+ /**
3405
+ * Returns the seconds since the user was last active on this computer. The SDK header does not define "active" any further; unverified against a live Steam client.
3406
+ * @returns the number of seconds, as an unsigned 32-bit integer
3407
+ */
3408
+ export function getSecondsSinceComputerActive(): number
3409
+ /** @returns the Steam universe this client connects to, or `null` when the SDK reports a value this binding does not name */
3410
+ export function getConnectedUniverse(): Universe | null
3411
+ /** @returns the battery charge in percent (0 to 100), or 255 while the computer is on AC power */
3412
+ export function getCurrentBatteryPower(): number
3413
+ /**
3414
+ * Returns the number of IPC calls made since the previous call, and starts a new count. Every IPC call costs at least a thread context switch, so a high count per frame means the game talks to Steam too often.
3415
+ * @returns the count since the previous call, as an unsigned 32-bit integer
3416
+ */
3417
+ export function getIpcCallCount(): number
3418
+ /**
3419
+ * Returns whether the overlay needs the game to present a frame (`Present` or `SwapBuffers`). Only games that redraw on events instead of every frame need this; the SDK suggests polling it about 33 times a second.
3420
+ * @returns `true` when a present is needed, otherwise `false`
3421
+ */
3422
+ export function overlayNeedsPresent(): boolean
3423
+ /**
3424
+ * Starts checking a file against the signing set on the partner site, for example to refuse modified executables. Resolves once Steam answers; the answer arrives while `runCallbacks()` runs.
3425
+ * An app with no signing set resolves with `NoSignaturesFoundForThisApp`, which is a result and not an error.
3426
+ * @param fileName - path of the file to check; a name with a NUL character is rejected
3427
+ * @returns the verdict for the file
3428
+ */
3429
+ export function checkFileSignature(fileName: string): Promise<FileSignatureStatus>
3430
+ /** @returns the length of the text the user last entered in the gamepad text dialog. The SDK header does not state the unit or whether the terminator counts; unverified against a live Steam client. */
3431
+ export function getEnteredGamepadTextLength(): number
3432
+ /** @returns `true` when Steam itself runs in VR mode, otherwise `false` */
3433
+ export function isSteamRunningInVr(): boolean
3434
+ /**
3435
+ * Sets the inset, in pixels, of overlay notifications from the corner the game chose for them.
3436
+ * @param horizontal - pixels from the side edge of that corner
3437
+ * @param vertical - pixels from the top or bottom edge of that corner
3438
+ */
3439
+ export function setOverlayNotificationInset(horizontal: number, vertical: number): void
3440
+ /** @returns `true` when HMD content is streamed through Steam Remote Play. The default is `true` unless the game's app info sets `VRHeadsetStreaming` to `0`. */
3441
+ export function isVrHeadsetStreamingEnabled(): boolean
3442
+ /**
3443
+ * Sets whether HMD content is streamed through Steam Remote Play. `true` streams the headset scene and blocks remote input; `false` streams the application window and allows remote input.
3444
+ * @param enabled - the new setting
3445
+ */
3446
+ export function setVrHeadsetStreamingEnabled(enabled: boolean): void
3447
+ /** @returns `true` when this Steam client is the Steam China launcher rather than the global client, otherwise `false` */
3448
+ export function isSteamChinaLauncher(): boolean
3449
+ /**
3450
+ * Loads the text filter dictionaries for the language the game runs in. Call it before `filterText`.
3451
+ * @returns `false` when filtering is unavailable for that language; `filterText` then returns the text unchanged
3452
+ */
3453
+ export function initFilterText(): boolean
3454
+ /**
3455
+ * Filters a message with the legally required filter and the user's account preferences. Needs `initFilterText()` first.
3456
+ * @param context - the kind of text being filtered
3457
+ * @param sourceSteamId64 - the 64-bit SteamID of whoever wrote the text
3458
+ * @param message - the text to filter
3459
+ * @returns the filtered text and the number of characters changed, or `null` when the message contains a NUL character or the SteamID is not a valid 64-bit value
3460
+ */
3461
+ export function filterText(context: TextFilteringContext, sourceSteamId64: bigint, message: string): FilteredText | null
3462
+ /**
3463
+ * Returns what Steam believes the machine's IPv6 connectivity to the internet is, on one protocol. It does not tell whether the Steam client itself connects over IPv6.
3464
+ * @param protocol - the protocol to test
3465
+ * @returns the state, or `null` when the SDK reports a value this binding does not name
3466
+ */
3467
+ export function getIpv6ConnectivityState(protocol: Ipv6Protocol): Ipv6ConnectivityState | null
3468
+ /**
3469
+ * Turns on or off Steam Input translation of controller input into mouse and keyboard input. Use it in game launchers that have no controller support of their own.
3470
+ * @param enabled - `true` to turn the translation on
3471
+ */
3472
+ export function setGameLauncherMode(enabled: boolean): void
3473
+ /**
3474
+ * Dismisses the full-screen gamepad text dialog that `showGamepadTextInput` opened. The header does not say whether that call's Promise then settles (unverified).
3475
+ * @returns the SDK's result as it is; the header does not say what `false` means (unverified)
3476
+ */
3477
+ export function dismissGamepadTextInput(): boolean
3478
+ /**
3479
+ * Dismisses the floating keyboard that `showFloatingGamepadTextInput` opened.
3480
+ * @returns the SDK's result as it is; the header does not say what `false` means (unverified)
3481
+ */
3482
+ export function dismissFloatingGamepadTextInput(): boolean
1357
3483
  }
1358
3484
  export declare namespace workshop {
1359
3485
  export interface UgcResult {