@hagicode/steamworks.js 0.0.0-stage → 0.1.6-dev.17

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 ADDED
@@ -0,0 +1,1182 @@
1
+ export declare function init(appId?: number | undefined | null): void
2
+ export declare function restartAppIfNecessary(appId: number): boolean
3
+ export declare function runCallbacks(): void
4
+ export declare function shutdown(): void
5
+ export declare function isConnected(): boolean
6
+ export interface PlayerSteamId {
7
+ steamId64: bigint
8
+ steamId32: string
9
+ accountId: number
10
+ }
11
+ export declare namespace achievement {
12
+ export function activate(achievement: string): boolean
13
+ export function isActivated(achievement: string): boolean
14
+ export function clear(achievement: string): boolean
15
+ export function names(): Array<string>
16
+ /**
17
+ * Fetches the global unlock percentages of every achievement. Resolves once Steam has answered;
18
+ * the request is driven by `runCallbacks()`.
19
+ */
20
+ export function requestGlobalPercentages(): Promise<void>
21
+ /**
22
+ * @returns the global percentage of players who unlocked the achievement (0 to 100), or `null` when no data is available.
23
+ * Call `requestGlobalPercentages()` first.
24
+ */
25
+ export function getAchievedPercent(achievement: string): number | null
26
+ }
27
+ export declare namespace apps {
28
+ export function isSubscribedApp(appId: number): boolean
29
+ export function isAppInstalled(appId: number): boolean
30
+ export function isDlcInstalled(appId: number): boolean
31
+ export function isSubscribedFromFreeWeekend(): boolean
32
+ export function isVacBanned(): boolean
33
+ export function isCybercafe(): boolean
34
+ export function isLowViolence(): boolean
35
+ export function isSubscribed(): boolean
36
+ export function appBuildId(): number
37
+ export function appInstallDir(appId: number): string
38
+ export function appOwner(): PlayerSteamId
39
+ export function availableGameLanguages(): Array<string>
40
+ export function currentGameLanguage(): string
41
+ export function currentBetaName(): string | null
42
+ /** @returns the command line the game was launched with, or an empty string */
43
+ export function launchCommandLine(): string
44
+ /** @returns the value of a query parameter from the Steam launch link, or an empty string when there is none */
45
+ export function launchQueryParam(key: string): string
46
+ }
47
+ export declare namespace auth {
48
+ /**
49
+ * @param steamId64 - The user steam id or game server steam id. Use as NetworkIdentity of the remote system that will authenticate the ticket. If it is peer-to-peer then the user steam ID. If it is a game server, then the game server steam ID may be used if it was obtained from a trusted 3rd party
50
+ * @param timeoutSeconds - The number of seconds to wait for the ticket to be validated. Default value is 10 seconds.
51
+ */
52
+ export function getSessionTicketWithSteamId(steamId64: bigint, timeoutSeconds?: number | undefined | null): Promise<Ticket>
53
+ /**
54
+ * @param ip - The string of IPv4 or IPv6 address. Use as NetworkIdentity of the remote system that will authenticate the ticket.
55
+ * @param timeoutSeconds - The number of seconds to wait for the ticket to be validated. Default value is 10 seconds.
56
+ */
57
+ export function getSessionTicketWithIp(ip: string, timeoutSeconds?: number | undefined | null): Promise<Ticket>
58
+ export function getAuthTicketForWebApi(identity: string, timeoutSeconds?: number | undefined | null): Promise<Ticket>
59
+ export class Ticket {
60
+ cancel(): void
61
+ getBytes(): Buffer
62
+ }
63
+ }
64
+ export declare namespace callback {
65
+ export const enum SteamCallback {
66
+ PersonaStateChange = 0,
67
+ SteamServersConnected = 1,
68
+ SteamServersDisconnected = 2,
69
+ SteamServerConnectFailure = 3,
70
+ LobbyDataUpdate = 4,
71
+ LobbyChatUpdate = 5,
72
+ P2PSessionRequest = 6,
73
+ P2PSessionConnectFail = 7,
74
+ GameLobbyJoinRequested = 8,
75
+ MicroTxnAuthorizationResponse = 9,
76
+ DownloadItemResult = 10,
77
+ UserStatsReceived = 11,
78
+ UserStatsStored = 12,
79
+ UserAchievementStored = 13,
80
+ GameOverlayActivated = 14,
81
+ GameRichPresenceJoinRequested = 15,
82
+ LobbyEnter = 16,
83
+ LobbyChatMsg = 17,
84
+ ScreenshotRequested = 18,
85
+ ScreenshotReady = 19,
86
+ NewUrlLaunchParameters = 20,
87
+ AuthSessionTicketResponse = 21,
88
+ ValidateAuthTicketResponse = 22
89
+ }
90
+ export function register<C extends keyof import('./callbacks').CallbackReturns>(steamCallback: C, handler: (value: import('./callbacks').CallbackReturns[C]) => void): Handle
91
+ export class Handle {
92
+ disconnect(): void
93
+ }
94
+ }
95
+ export declare namespace cloud {
96
+ export function isEnabledForAccount(): boolean
97
+ export function isEnabledForApp(): boolean
98
+ export function setEnabledForApp(enabled: boolean): void
99
+ export function readFile(name: string): string
100
+ export function writeFile(name: string, content: string): boolean
101
+ export function deleteFile(name: string): boolean
102
+ export function fileExists(name: string): boolean
103
+ export function listFiles(): Array<FileInfo>
104
+ /** The platforms a cloud file syncs to. */
105
+ export const enum SyncPlatform {
106
+ None = 0,
107
+ Windows = 1,
108
+ MacOS = 2,
109
+ Linux = 3,
110
+ /** Every platform the binding knows about. */
111
+ All = 4
112
+ }
113
+ /**
114
+ * Shares a cloud file so others can link to it. Resolves with the share handle.
115
+ * Resolution needs `runCallbacks()`, which `init()` already calls.
116
+ */
117
+ export function shareFile(name: string): Promise<bigint>
118
+ /**
119
+ * Stops syncing a cloud file. The Steam copy stays, and the local copy is no longer synced.
120
+ * @returns true on success
121
+ */
122
+ export function forgetFile(name: string): boolean
123
+ /** @returns the platform a cloud file syncs to. Rejects when the file syncs to a combination of platforms. */
124
+ export function getSyncPlatforms(name: string): SyncPlatform
125
+ /** Sets the platform a cloud file syncs to. */
126
+ export function setSyncPlatforms(name: string, platform: SyncPlatform): void
127
+ export class FileInfo {
128
+ name: string
129
+ size: bigint
130
+ }
131
+ }
132
+ export declare namespace friends {
133
+ export interface FriendInfo {
134
+ steamId64: bigint
135
+ name: string
136
+ /** The nickname the local user set for this friend, or `null` when none is set. */
137
+ nickName?: string | null
138
+ }
139
+ export interface CoplayInfo {
140
+ /** AppID of the game played together, `0` when there is none. */
141
+ appId: number
142
+ /** Seconds since the local user last played with this user. */
143
+ time: number
144
+ }
145
+ export const enum FriendState {
146
+ Offline = 0,
147
+ Online = 1,
148
+ Invisible = 2,
149
+ Busy = 3,
150
+ Away = 4,
151
+ Snooze = 5,
152
+ LookingToPlay = 6,
153
+ LookingToTrade = 7
154
+ }
155
+ /** @param flags - Steam friend relationship flags (`FriendFlags` bits), e.g. `0x4` for immediate friends */
156
+ export function getFriends(flags: number): Array<FriendInfo>
157
+ /** Players the local user has recently played with. */
158
+ export function getCoplayFriends(): Array<FriendInfo>
159
+ export function getFriendState(steamId64: bigint): FriendState
160
+ /** @returns the AppID of the game the friend is playing, or `null` when they are not in a game */
161
+ export function getFriendGamePlayed(steamId64: bigint): number | null
162
+ export function getFriendCoplayInfo(steamId64: bigint): CoplayInfo
163
+ /** @returns the small (32x32) avatar as RGBA pixels, or `null` when it has not been loaded */
164
+ export function getSmallAvatar(steamId64: bigint): Buffer | null
165
+ /** @returns the medium (64x64) avatar as RGBA pixels, or `null` when it has not been loaded */
166
+ export function getMediumAvatar(steamId64: bigint): Buffer | null
167
+ /** @returns the large (184x184) avatar as RGBA pixels, or `null` when it has not been loaded */
168
+ export function getLargeAvatar(steamId64: bigint): Buffer | null
169
+ /** @returns true when Steam will fetch the user information asynchronously (PersonaStateChange follows) */
170
+ export function requestUserInformation(steamId64: bigint, nameOnly: boolean): boolean
171
+ /** Clears all of the local user's Rich Presence keys (see `localplayer.setRichPresence`). */
172
+ export function clearRichPresence(): void
173
+ /** Sends a game invite that carries `connectString` to the friend. */
174
+ export function inviteUserToGame(steamId64: bigint, connectString: string): void
175
+ /** Marks the user as played with. The local user must currently be in game with them. */
176
+ export function setPlayedWith(steamId64: bigint): void
177
+ }
178
+ export declare namespace input {
179
+ export const enum InputType {
180
+ Unknown = 'Unknown',
181
+ SteamController = 'SteamController',
182
+ XBox360Controller = 'XBox360Controller',
183
+ XBoxOneController = 'XBoxOneController',
184
+ GenericGamepad = 'GenericGamepad',
185
+ PS4Controller = 'PS4Controller',
186
+ AppleMFiController = 'AppleMFiController',
187
+ AndroidController = 'AndroidController',
188
+ SwitchJoyConPair = 'SwitchJoyConPair',
189
+ SwitchJoyConSingle = 'SwitchJoyConSingle',
190
+ SwitchProController = 'SwitchProController',
191
+ MobileTouch = 'MobileTouch',
192
+ PS3Controller = 'PS3Controller',
193
+ PS5Controller = 'PS5Controller',
194
+ SteamDeckController = 'SteamDeckController'
195
+ }
196
+ export interface AnalogActionVector {
197
+ x: number
198
+ y: number
199
+ }
200
+ export function init(): void
201
+ export function getControllers(): Array<Controller>
202
+ export function getActionSet(actionSetName: string): bigint
203
+ export function getDigitalAction(actionName: string): bigint
204
+ export function getAnalogAction(actionName: string): bigint
205
+ export function shutdown(): void
206
+ export interface DigitalActionData {
207
+ /** `true` while the digital action is pressed. */
208
+ state: boolean
209
+ /** `false` when the action is not available for this controller. */
210
+ active: boolean
211
+ }
212
+ export interface AnalogActionData {
213
+ x: number
214
+ y: number
215
+ /** `false` when the action is not available for this controller. */
216
+ active: boolean
217
+ }
218
+ /**
219
+ * @param controllerHandle - a controller handle from `getConnectedControllers`
220
+ * @param actionHandle - a digital action handle from `getDigitalAction`
221
+ */
222
+ export function getDigitalActionData(controllerHandle: bigint, actionHandle: bigint): DigitalActionData
223
+ /** @param actionHandle - an analog action handle from `getAnalogAction` */
224
+ export function getAnalogActionData(controllerHandle: bigint, actionHandle: bigint): AnalogActionData
225
+ /** @returns the Steam action origins (numeric `EInputActionOrigin` values) bound to a digital action; empty when unbound */
226
+ export function getDigitalActionOrigins(controllerHandle: bigint, actionSetHandle: bigint, actionHandle: bigint): Array<number>
227
+ /** @returns the Steam action origins (numeric `EInputActionOrigin` values) bound to an analog action; empty when unbound */
228
+ export function getAnalogActionOrigins(controllerHandle: bigint, actionSetHandle: bigint, actionHandle: bigint): Array<number>
229
+ /** @returns the display name of an action origin, such as "A Button"; empty for an unknown origin */
230
+ export function getStringForActionOrigin(origin: number): string
231
+ /** @returns the glyph image path of an action origin */
232
+ export function getGlyphForActionOrigin(origin: number): string
233
+ export class Controller {
234
+ activateActionSet(actionSetHandle: bigint): void
235
+ isDigitalActionPressed(actionHandle: bigint): boolean
236
+ getAnalogActionVector(actionHandle: bigint): AnalogActionVector
237
+ getType(): InputType
238
+ getHandle(): bigint
239
+ }
240
+ }
241
+ export declare namespace leaderboard {
242
+ export const enum LeaderboardSortMethod {
243
+ Ascending = 0,
244
+ Descending = 1
245
+ }
246
+ export const enum LeaderboardDisplayType {
247
+ Numeric = 0,
248
+ TimeSeconds = 1,
249
+ TimeMilliSeconds = 2
250
+ }
251
+ export const enum LeaderboardDataRequest {
252
+ Global = 0,
253
+ GlobalAroundUser = 1,
254
+ Friends = 2
255
+ }
256
+ export const enum UploadScoreMethod {
257
+ /** Keeps the better of the existing score and the new one. */
258
+ KeepBest = 0,
259
+ /** Replaces the existing score, even when it is worse. */
260
+ ForceUpdate = 1
261
+ }
262
+ export interface LeaderboardScoreUploaded {
263
+ /** The score Steam stored for the user. */
264
+ score: number
265
+ /** `false` when the uploaded score did not replace the existing one. */
266
+ wasChanged: boolean
267
+ globalRankNew: number
268
+ globalRankPrevious: number
269
+ }
270
+ export interface LeaderboardEntry {
271
+ steamId64: bigint
272
+ globalRank: number
273
+ score: number
274
+ details: Array<number>
275
+ }
276
+ /**
277
+ * Finds a leaderboard by name.
278
+ * @returns the leaderboard, or `null` when no leaderboard has that name
279
+ */
280
+ export function find(name: string): Promise<Leaderboard | null>
281
+ /**
282
+ * Finds a leaderboard by name, creating it with the given sort method and display type when it does not exist.
283
+ * @returns the leaderboard, or `null` when Steam could not find or create it
284
+ */
285
+ export function findOrCreate(name: string, sortMethod: LeaderboardSortMethod, displayType: LeaderboardDisplayType): Promise<Leaderboard | null>
286
+ /** A leaderboard handle returned by `find` or `findOrCreate`. */
287
+ export class Leaderboard {
288
+ /** @returns the leaderboard name */
289
+ getName(): string
290
+ /** @returns the number of entries on the leaderboard */
291
+ getEntryCount(): number
292
+ /** @returns the sort method, or `null` when Steam does not report one */
293
+ getSortMethod(): LeaderboardSortMethod | null
294
+ /** @returns the display type, or `null` when Steam does not report one */
295
+ getDisplayType(): LeaderboardDisplayType | null
296
+ /**
297
+ * Uploads a score for the local user.
298
+ * @param details - integers stored with the score alongside it
299
+ * @returns the result, or `null` when Steam reports that the upload did not succeed
300
+ */
301
+ uploadScore(method: UploadScoreMethod, score: number, details: Array<number>): Promise<LeaderboardScoreUploaded | null>
302
+ /**
303
+ * Downloads leaderboard entries for a range of ranks.
304
+ * @param start - first rank index (0-based) in the requested range
305
+ * @param end - last rank index (exclusive) in the requested range
306
+ * @param maxDetails - maximum number of detail integers returned per entry
307
+ */
308
+ downloadEntries(request: LeaderboardDataRequest, start: number, end: number, maxDetails: number): Promise<Array<LeaderboardEntry>>
309
+ }
310
+ }
311
+ export declare namespace localplayer {
312
+ export function getSteamId(): PlayerSteamId
313
+ export function getName(): string
314
+ export function getLevel(): number
315
+ /** @returns the 2 digit ISO 3166-1-alpha-2 format country code which client is running in, e.g. "US" or "UK". */
316
+ export function getIpCountry(): string
317
+ export function setRichPresence(key: string, value?: string | undefined | null): void
318
+ }
319
+ export declare namespace matchmaking {
320
+ export const enum LobbyType {
321
+ Private = 0,
322
+ FriendsOnly = 1,
323
+ Public = 2,
324
+ Invisible = 3
325
+ }
326
+ export function createLobby(lobbyType: LobbyType, maxMembers: number): Promise<Lobby>
327
+ export function joinLobby(lobbyId: bigint): Promise<Lobby>
328
+ export function getLobbies(): Promise<Array<Lobby>>
329
+ export class Lobby {
330
+ id: bigint
331
+ join(): Promise<Lobby>
332
+ leave(): void
333
+ openInviteDialog(): void
334
+ getMemberCount(): bigint
335
+ getMemberLimit(): bigint | null
336
+ getMembers(): Array<PlayerSteamId>
337
+ getOwner(): PlayerSteamId
338
+ setJoinable(joinable: boolean): boolean
339
+ getData(key: string): string | null
340
+ setData(key: string, value: string): boolean
341
+ deleteData(key: string): boolean
342
+ /** Get an object containing all the lobby data */
343
+ getFullData(): Record<string, string>
344
+ /**
345
+ * Merge current lobby data with provided data in a single batch
346
+ * @returns true if all data was set successfully
347
+ */
348
+ mergeFullData(data: Record<string, string>): boolean
349
+ }
350
+ }
351
+ export declare namespace matchmakingServers {
352
+ /** Details of one game server. */
353
+ export interface GameServerDetails {
354
+ ip: string
355
+ /** The game connection port. */
356
+ port: number
357
+ queryPort: number
358
+ name: string
359
+ map: string
360
+ /** Players currently on the server. */
361
+ players: number
362
+ maxPlayers: number
363
+ /** Latency in milliseconds. */
364
+ ping: number
365
+ }
366
+ export interface PlayerDetails {
367
+ name: string
368
+ score: number
369
+ /** Time played in seconds. */
370
+ timePlayed: number
371
+ }
372
+ export interface ServerRule {
373
+ key: string
374
+ value: string
375
+ }
376
+ /**
377
+ * Requests the internet server list for an app.
378
+ * @param filters - Steam matchmaking filters, for example `{ gamedir: 'mygame' }`
379
+ */
380
+ export function internetServerList(appId: number, filters?: Record<string, string> | undefined | null): ServerListRequest
381
+ /** Requests the list of servers the user has favourited for an app. */
382
+ export function favoritesServerList(appId: number, filters?: Record<string, string> | undefined | null): ServerListRequest
383
+ /** Requests the list of servers the user has played on recently for an app. */
384
+ export function historyServerList(appId: number, filters?: Record<string, string> | undefined | null): ServerListRequest
385
+ /** Requests the list of servers that the user's friends are playing on for an app. */
386
+ export function friendsServerList(appId: number, filters?: Record<string, string> | undefined | null): ServerListRequest
387
+ /** Requests the list of servers on the local network for an app. */
388
+ export function lanServerList(appId: number): ServerListRequest
389
+ /**
390
+ * Pings one server.
391
+ * @returns the server details, including latency; rejects when the server does not respond
392
+ */
393
+ export function pingServer(ip: string, port: number): Promise<GameServerDetails>
394
+ /**
395
+ * Lists the players on one server.
396
+ * @returns the players, or rejects when the server does not respond
397
+ */
398
+ export function playerDetails(ip: string, port: number): Promise<Array<PlayerDetails>>
399
+ /**
400
+ * Reads the rules (key and value pairs) of one server.
401
+ * @returns the rules, or rejects when the server does not respond
402
+ */
403
+ export function serverRules(ip: string, port: number): Promise<Array<ServerRule>>
404
+ /** A server list request. Call `release()` when you no longer need it. */
405
+ export class ServerListRequest {
406
+ /** @returns the number of servers in the list */
407
+ getServerCount(): number
408
+ /**
409
+ * @param index - 0-based index into the list
410
+ * @returns the details of the server at `index`
411
+ */
412
+ getServerDetails(index: number): GameServerDetails
413
+ /** Re-queries the whole list. */
414
+ refreshQuery(): void
415
+ /** Re-queries one server in the list. */
416
+ refreshServer(index: number): void
417
+ /** @returns true while a refresh is in progress */
418
+ isRefreshing(): boolean
419
+ /** Releases the request. Using it afterwards returns an error. */
420
+ release(): void
421
+ }
422
+ }
423
+ export declare namespace networking {
424
+ export interface P2PPacket {
425
+ data: Buffer
426
+ size: number
427
+ steamId: PlayerSteamId
428
+ }
429
+ /** The method used to send a packet */
430
+ export const enum SendType {
431
+ /**
432
+ * Send the packet directly over udp.
433
+ *
434
+ * Can't be larger than 1200 bytes
435
+ */
436
+ Unreliable = 0,
437
+ /**
438
+ * Like `Unreliable` but doesn't buffer packets
439
+ * sent before the connection has started.
440
+ */
441
+ UnreliableNoDelay = 1,
442
+ /**
443
+ * Reliable packet sending.
444
+ *
445
+ * Can't be larger than 1 megabyte.
446
+ */
447
+ Reliable = 2,
448
+ /**
449
+ * Like `Reliable` but applies the nagle
450
+ * algorithm to packets being sent
451
+ */
452
+ ReliableWithBuffering = 3
453
+ }
454
+ export function sendP2PPacket(steamId64: bigint, sendType: SendType, data: Buffer): boolean
455
+ export function isP2PPacketAvailable(): number
456
+ export function readP2PPacket(size: number): P2PPacket
457
+ export function acceptP2PSession(steamId64: bigint): void
458
+ export function sendP2PPacketOnChannel(steamId64: bigint, sendType: SendType, data: Buffer, channel: number): boolean
459
+ /** @returns the size of the next packet on the channel, or 0 when none is waiting */
460
+ export function isP2PPacketAvailableOnChannel(channel: number): number
461
+ /** Reads the next packet on a channel. Rejects when no packet is waiting. */
462
+ export function readP2PPacketFromChannel(size: number, channel: number): P2PPacket
463
+ /**
464
+ * Closes the P2P session with a user.
465
+ * @returns true when a session existed and was closed
466
+ */
467
+ export function closeP2PSession(steamId64: bigint): boolean
468
+ }
469
+ export declare namespace networkingMessages {
470
+ /** A message received on a channel, from `receiveMessagesOnChannel`. */
471
+ export interface ReceivedMessage {
472
+ data: Buffer
473
+ /** SteamID of the sender, or `null` when the sender has no SteamID. */
474
+ steamId64?: bigint | null
475
+ /** The channel the message was sent on. */
476
+ channel: number
477
+ }
478
+ /** A session that failed to be established, passed to the `onSessionFailed` handler. */
479
+ export interface SessionFailure {
480
+ /** SteamID of the peer, or `null` when the peer has no SteamID. */
481
+ steamId64?: bigint | null
482
+ /** Steam's end reason code, or `null` when Steam gave none. */
483
+ endReason?: number | null
484
+ }
485
+ /**
486
+ * Sends a message to a Steam user on a channel. A session is created implicitly when needed.
487
+ * The receiver must call `receiveMessagesOnChannel` with the same channel.
488
+ * @param steamId64 - SteamID of the receiver
489
+ * @param sendFlags - Bitmask of Steam's `k_nSteamNetworkingSend_*` values, for example `8` for reliable or `0` for unreliable
490
+ * @param data - Payload bytes
491
+ * @param channel - Routing number; use `0` when you do not need channels
492
+ */
493
+ export function sendMessageToUser(steamId64: bigint, sendFlags: number, data: Buffer, channel: number): void
494
+ /**
495
+ * Receives the messages waiting on a channel. Returns an empty array when there are none.
496
+ * @param channel - The channel to read; messages on other channels are not returned
497
+ * @param batchSize - Maximum number of messages to return
498
+ */
499
+ export function receiveMessagesOnChannel(channel: number, batchSize: number): Array<ReceivedMessage>
500
+ /**
501
+ * Registers the handler for incoming session requests, replacing any previous handler.
502
+ * Steam reports requests during `runCallbacks()`, and the handler then runs on the JavaScript event loop.
503
+ * It must call `accept` or `reject` on the request.
504
+ */
505
+ export function onSessionRequest(handler: (request: SessionRequest) => void): void
506
+ /**
507
+ * Registers the handler for session failures, replacing any previous handler.
508
+ * Steam reports failures during `runCallbacks()`, and the handler then runs on the JavaScript event loop.
509
+ */
510
+ export function onSessionFailed(handler: (failure: SessionFailure) => void): void
511
+ /**
512
+ * An incoming session request. Call `accept` or `reject` in the `onSessionRequest` handler.
513
+ * A request that is never answered is rejected when this object is garbage collected.
514
+ */
515
+ export class SessionRequest {
516
+ /** SteamID of the user asking to start a session, or `null` when the peer has no SteamID. */
517
+ get steamId64(): bigint | null
518
+ /**
519
+ * Accepts the session.
520
+ * @returns `false` when Steam did not accept it.
521
+ */
522
+ accept(): boolean
523
+ /** Rejects the session, so it is not established. */
524
+ reject(): void
525
+ }
526
+ }
527
+ export declare namespace networkingSockets {
528
+ /** High-level state of a connection, as reported by Steam. */
529
+ export const enum NetworkingConnectionState {
530
+ /** The connection handle is invalid or the connection has been closed. */
531
+ None = 0,
532
+ /** Trying to establish the connection, including authentication. */
533
+ Connecting = 1,
534
+ /** Looking for a route to the peer. */
535
+ FindingRoute = 2,
536
+ /** Connected and ready to send and receive. */
537
+ Connected = 3,
538
+ /** The peer closed the connection. */
539
+ ClosedByPeer = 4,
540
+ /** Steam detected a problem on the local side. */
541
+ ProblemDetectedLocally = 5
542
+ }
543
+ /** The kind of a `SocketEvent`. */
544
+ export const enum ListenSocketEventKind {
545
+ /** A peer asked to connect. Answer it with `accept` or `reject`. */
546
+ Connecting = 0,
547
+ /** A connection was established. Get it with `takeConnection`. */
548
+ Connected = 1,
549
+ /** A connection ended. */
550
+ Disconnected = 2
551
+ }
552
+ /** Connection details from `Connection.getInfo`. */
553
+ export interface ConnectionInfo {
554
+ state: NetworkingConnectionState
555
+ /** SteamID of the remote peer, or `null` when it is unknown. */
556
+ steamId64?: bigint | null
557
+ /** User data set with `setUserData`. `-1` when none is set. */
558
+ userData: bigint
559
+ /** Steam's end reason code once the connection has ended, otherwise `null`. */
560
+ endReason?: number | null
561
+ }
562
+ /** Real-time statistics from `Connection.getRealtimeStatus`. */
563
+ export interface ConnectionRealtimeStatus {
564
+ state: NetworkingConnectionState
565
+ /** Round-trip ping in milliseconds. */
566
+ ping: number
567
+ /** Quality of the link as measured locally, from 0 to 1. */
568
+ connectionQualityLocal: number
569
+ /** Quality of the link as measured by the peer, from 0 to 1. */
570
+ connectionQualityRemote: number
571
+ outBytesPerSec: number
572
+ inBytesPerSec: number
573
+ sendRateBytesPerSec: number
574
+ pendingUnreliable: number
575
+ pendingReliable: number
576
+ sentUnackedReliable: number
577
+ queuedSendBytes: number
578
+ }
579
+ /** A message received from a poll group, from `PollGroup.receiveMessages`. */
580
+ export interface PollGroupMessage {
581
+ data: Buffer
582
+ /** The user data of the connection that received the message. */
583
+ connectionUserData: bigint
584
+ }
585
+ /**
586
+ * Creates a listen socket on a UDP address. Clients connect with `connectByIpAddress`.
587
+ * @param address - Local address and port, for example `"0.0.0.0:27015"`
588
+ */
589
+ export function createListenSocketIp(address: string): ListenSocket
590
+ /**
591
+ * Creates a listen socket for clients that connect by SteamID with `connectP2P`.
592
+ * @param localVirtualPort - Virtual port clients use. Use `0` when the app has only one listen socket.
593
+ */
594
+ export function createListenSocketP2P(localVirtualPort: number): ListenSocket
595
+ /**
596
+ * Connects to a listen socket on a UDP IP address. The connection is not ready until its state is `Connected`.
597
+ * @param address - Remote address and port, for example `"203.0.113.5:27015"`
598
+ */
599
+ export function connectByIpAddress(address: string): Connection
600
+ /**
601
+ * Connects to a peer by SteamID through the Steam relay network. The peer must listen with `createListenSocketP2P`.
602
+ * @param steamId64 - SteamID of the peer
603
+ * @param remoteVirtualPort - Virtual port the peer listens on
604
+ */
605
+ export function connectP2P(steamId64: bigint, remoteVirtualPort: number): Connection
606
+ /** Creates a poll group for batch receiving from many connections. */
607
+ export function createPollGroup(): PollGroup
608
+ /**
609
+ * Starts authentication, which is needed for authenticated connections. Steam retries on its own if it fails.
610
+ * Call it at startup if you expect to make authenticated connections.
611
+ * @returns The authentication status after the call; poll `getAuthenticationStatus` to follow progress.
612
+ */
613
+ export function initAuthentication(): networkingUtils.NetworkingAvailability
614
+ /** Returns the current authentication status. */
615
+ export function getAuthenticationStatus(): networkingUtils.NetworkingAvailability
616
+ /**
617
+ * An event from a listen socket. Read `kind` first.
618
+ * A `Connecting` event must be answered with `accept` or `reject`. A `Connected` event gives its connection with `takeConnection`.
619
+ */
620
+ export class SocketEvent {
621
+ /** The kind of event. */
622
+ get kind(): ListenSocketEventKind
623
+ /** SteamID of the remote peer, or `null` when the peer has no SteamID. */
624
+ get steamId64(): bigint | null
625
+ /** User data of the connection, as stored by Steam. */
626
+ get userData(): bigint
627
+ /** Steam's end reason code, set only for `Disconnected` events. */
628
+ get endReason(): number | null
629
+ /** Accepts a `Connecting` event. The connection then arrives as a `Connected` event on the same listen socket. */
630
+ accept(): void
631
+ /**
632
+ * Rejects a `Connecting` event.
633
+ * @param endReason - Steam end reason code. Defaults to the generic application code.
634
+ * @param debugMessage - Optional diagnostic text sent to the peer
635
+ * @returns `false` when Steam could not close the connection.
636
+ */
637
+ reject(endReason?: number | undefined | null, debugMessage?: string | undefined | null): boolean
638
+ /** Takes the connection of a `Connected` event. Can be called once. */
639
+ takeConnection(): Connection
640
+ }
641
+ /**
642
+ * A listening socket, from `createListenSocketIp` or `createListenSocketP2P`.
643
+ * Poll `tryReceiveEvent` regularly while `runCallbacks()` runs, and answer connection requests quickly.
644
+ * Existing connections stay open after `close`; the socket only stops accepting new ones.
645
+ */
646
+ export class ListenSocket {
647
+ /** Returns the next pending event, or `null` immediately when there is none. Never waits. */
648
+ tryReceiveEvent(): SocketEvent | null
649
+ /** Stops listening. Connections that already exist are not closed. */
650
+ close(): void
651
+ }
652
+ /** A connection to a peer. Close it with `close` when finished; operations after that return errors. */
653
+ export class Connection {
654
+ /**
655
+ * Sends one message to the peer.
656
+ * @param sendFlags - Bitmask of Steam's `k_nSteamNetworkingSend_*` values, for example `8` for reliable or `0` for unreliable
657
+ */
658
+ send(data: Buffer, sendFlags: number): void
659
+ /** Sends messages that Nagle's algorithm is holding back, as soon as possible. */
660
+ flush(): void
661
+ /** Receives up to `batchSize` messages. Returns an empty array when none are waiting. */
662
+ receive(batchSize: number): Array<Buffer>
663
+ /**
664
+ * Closes the connection and frees its Steam handle. Calling it again returns `false`.
665
+ * @param endReason - Steam end reason code sent to the peer. Defaults to the generic application code.
666
+ * @param debugMessage - Optional diagnostic text sent to the peer
667
+ * @param linger - When `true`, Steam tries to send pending reliable data before closing
668
+ * @returns `false` when Steam could not close the connection
669
+ */
670
+ close(endReason?: number | undefined | null, debugMessage?: string | undefined | null, linger?: boolean | undefined | null): boolean
671
+ /** Returns the user data set with `setUserData`, or `-1` when none is set. */
672
+ getUserData(): bigint
673
+ /** Stores user data on the connection. Steam returns it in events and message info. */
674
+ setUserData(userData: bigint): void
675
+ /** Sets a name for the connection, used mostly for debugging. */
676
+ setName(name: string): void
677
+ /** Adds the connection to a poll group, so its messages come out of `PollGroup.receiveMessages`. */
678
+ setPollGroup(pollGroup: PollGroup): void
679
+ /** Removes the connection from its poll group. */
680
+ clearPollGroup(): void
681
+ /** Returns the state, remote SteamID and end reason of the connection. */
682
+ getInfo(): ConnectionInfo
683
+ /** Returns live statistics: ping, link quality and bandwidth. */
684
+ getRealtimeStatus(): ConnectionRealtimeStatus
685
+ }
686
+ /** A group of connections that can be polled together, from `createPollGroup`. */
687
+ export class PollGroup {
688
+ /**
689
+ * Receives up to `batchSize` messages from all connections in the group.
690
+ * The result never has more than `batchSize` entries.
691
+ */
692
+ receiveMessages(batchSize: number): Array<PollGroupMessage>
693
+ /**
694
+ * Destroys the poll group. Connections in it stay open but are no longer polled by it.
695
+ * @returns `false` when the group was already closed.
696
+ */
697
+ close(): boolean
698
+ }
699
+ }
700
+ export declare namespace networkingUtils {
701
+ /**
702
+ * Availability of a networking resource. Covers every value of Steam's `ESteamNetworkingAvailability`.
703
+ * The numbers assigned here are not Steam's codes; compare by name.
704
+ */
705
+ export const enum NetworkingAvailability {
706
+ /** Steam has not tried to use this resource yet. */
707
+ NeverTried = 0,
708
+ /** Waiting for another resource before it can be acquired. */
709
+ Waiting = 1,
710
+ /** Trying now, but not successful yet. */
711
+ Attempting = 2,
712
+ /** Online and available. */
713
+ Current = 3,
714
+ /** Steam has no information about this resource. */
715
+ Unknown = 4,
716
+ /** A dependent resource is missing, so this service cannot be used. */
717
+ CannotTry = 5,
718
+ /** Tried for long enough without ever succeeding. */
719
+ Failed = 6,
720
+ /** Worked before, but now there is a problem. */
721
+ Previously = 7,
722
+ /** Failed earlier and is retrying. */
723
+ Retrying = 8
724
+ }
725
+ /** Detailed relay network status, from `getDetailedRelayNetworkStatus`. */
726
+ export interface RelayNetworkStatus {
727
+ /** Summary status. `Current` means relay network initialisation has completed. */
728
+ availability: NetworkingAvailability
729
+ /** `true` while a latency measurement is in progress or waiting for a prerequisite. */
730
+ isPingMeasurementInProgress: boolean
731
+ /** Status of obtaining the network config, a prerequisite for relay access. */
732
+ networkConfig: NetworkingAvailability
733
+ /** Ability to reach any relay. */
734
+ anyRelay: NetworkingAvailability
735
+ /** Non-localised English message for diagnostics only. */
736
+ debuggingMessage: string
737
+ }
738
+ /**
739
+ * Starts relay network access. Call it at startup if you expect to use P2P or relayed connections.
740
+ * Steam retries automatically when needed, so calling it again only forces a retry after a failure.
741
+ */
742
+ export function initRelayNetworkAccess(): void
743
+ /** Returns the summary availability of the relay network. */
744
+ export function getRelayNetworkStatus(): NetworkingAvailability
745
+ /** Returns the detailed relay network status, including the network config and relay reachability. */
746
+ export function getDetailedRelayNetworkStatus(): RelayNetworkStatus
747
+ }
748
+ export declare namespace overlay {
749
+ export const enum Dialog {
750
+ Friends = 0,
751
+ Community = 1,
752
+ Players = 2,
753
+ Settings = 3,
754
+ OfficialGameGroup = 4,
755
+ Stats = 5,
756
+ Achievements = 6
757
+ }
758
+ export const enum StoreFlag {
759
+ None = 0,
760
+ AddToCart = 1,
761
+ AddToCartAndShow = 2
762
+ }
763
+ export function activateDialog(dialog: Dialog): void
764
+ export function activateDialogToUser(dialog: Dialog, steamId64: bigint): void
765
+ export function activateInviteDialog(lobbyId: bigint): void
766
+ export function activateToWebPage(url: string): void
767
+ export function activateToStore(appId: number, flag: StoreFlag): void
768
+ }
769
+ export declare namespace remotePlay {
770
+ export interface RemotePlaySessionInfo {
771
+ sessionId: number
772
+ steamId64: bigint
773
+ }
774
+ export interface RemotePlayResolution {
775
+ width: number
776
+ height: number
777
+ }
778
+ export const enum DeviceFormFactor {
779
+ Phone = 0,
780
+ Tablet = 1,
781
+ Computer = 2,
782
+ TV = 3
783
+ }
784
+ export interface RemotePlaySessionDetails {
785
+ /** Name of the client device, or `null` when the session has ended. */
786
+ clientName?: string
787
+ /** Form factor of the client device, or `null` when unavailable. */
788
+ formFactor?: DeviceFormFactor
789
+ /** Resolution of the client device, or `null` when unavailable. */
790
+ resolution?: RemotePlayResolution
791
+ }
792
+ /** Lists the active Remote Play sessions. */
793
+ export function sessions(): Array<RemotePlaySessionInfo>
794
+ /** Reads the client name, form factor and resolution of one session. */
795
+ export function sessionDetails(sessionId: number): RemotePlaySessionDetails
796
+ /**
797
+ * Invites a friend to join the game with Remote Play Together.
798
+ * @returns true when the invite was sent
799
+ */
800
+ export function invite(steamId64: bigint): boolean
801
+ }
802
+ export declare namespace screenshots {
803
+ /** Turns the Steam screenshot hotkey into a `ScreenshotRequested` callback, so the game takes the screenshot itself. */
804
+ export function hookScreenshots(hook: boolean): void
805
+ export function isScreenshotsHooked(): boolean
806
+ /** Triggers a screenshot, the same as the player pressing the screenshot hotkey. */
807
+ export function triggerScreenshot(): void
808
+ /**
809
+ * Adds an image file to the Steam screenshot library.
810
+ * @returns the screenshot handle, which `ScreenshotReady` also reports
811
+ */
812
+ export function addScreenshotToLibrary(filename: string, thumbnailFilename: string | undefined | null, width: number, height: number): number
813
+ }
814
+ export declare namespace stats {
815
+ export function getInt(name: string): number | null
816
+ export function setInt(name: string, value: number): boolean
817
+ export function store(): boolean
818
+ export function resetAll(achievementsToo: boolean): boolean
819
+ /** @returns the float stat value, or `null` when the stat is not defined */
820
+ export function getFloat(name: string): number | null
821
+ /** Sets a float stat. The value is stored as a 32-bit float. Returns `false` when Steam rejects it. */
822
+ export function setFloat(name: string, value: number): boolean
823
+ /** @returns the number of achievements defined for the game, or `null` when statistics are not available */
824
+ export function getNumAchievements(): number | null
825
+ /** Asks Steam to fetch another user's statistics. The result arrives later through the `UserStatsReceived` callback. */
826
+ export function requestUserStats(steamId64: bigint): void
827
+ }
828
+ export declare namespace timeline {
829
+ export const enum TimelineGameMode {
830
+ Playing = 0,
831
+ Staging = 1,
832
+ Menus = 2,
833
+ LoadingScreen = 3
834
+ }
835
+ export const enum TimelineEventClipPriority {
836
+ None = 0,
837
+ Standard = 1,
838
+ Featured = 2
839
+ }
840
+ /** Sets the game mode shown on the Steam timeline. */
841
+ export function setGameMode(mode: TimelineGameMode): void
842
+ /** Shows a state description on the timeline for `durationSeconds`. An empty description is allowed. */
843
+ export function setStateDescription(description: string, durationSeconds: number): void
844
+ /** Clears the state description after `durationSeconds`. */
845
+ export function clearStateDescription(durationSeconds: number): void
846
+ /**
847
+ * Marks an event on the timeline.
848
+ * @param startOffsetSeconds - seconds from now at which the event starts (may be negative)
849
+ * @param durationSeconds - how long the event lasts, must not be negative
850
+ */
851
+ export function addEvent(icon: string, title: string, description: string, priority: number, startOffsetSeconds: number, durationSeconds: number, clipPriority: TimelineEventClipPriority): void
852
+ }
853
+ export declare namespace utils {
854
+ export function getAppId(): number
855
+ export function getServerRealTime(): number
856
+ export function isSteamRunningOnSteamDeck(): boolean
857
+ export const enum GamepadTextInputMode {
858
+ Normal = 0,
859
+ Password = 1
860
+ }
861
+ export const enum GamepadTextInputLineMode {
862
+ SingleLine = 0,
863
+ MultipleLines = 1
864
+ }
865
+ /** @returns the entered text, or null if cancelled or could not show the input */
866
+ export function showGamepadTextInput(inputMode: GamepadTextInputMode, inputLineMode: GamepadTextInputLineMode, description: string, maxCharacters: number, existingText?: string | undefined | null): Promise<string | null>
867
+ export const enum FloatingGamepadTextInputMode {
868
+ SingleLine = 0,
869
+ MultipleLines = 1,
870
+ Email = 2,
871
+ Numeric = 3
872
+ }
873
+ /** @returns true if the floating keyboard was shown, otherwise, false */
874
+ export function showFloatingGamepadTextInput(keyboardMode: FloatingGamepadTextInputMode, x: number, y: number, width: number, height: number): Promise<boolean>
875
+ /** @returns true when the Steam overlay is enabled for the running game */
876
+ export function isOverlayEnabled(): boolean
877
+ /** @returns true when Steam is running in Big Picture mode */
878
+ export function isSteamInBigPictureMode(): boolean
879
+ /** @returns the language code of the Steam UI, for example `english` or `schinese` */
880
+ export function getUiLanguage(): string
881
+ }
882
+ export declare namespace workshop {
883
+ export interface UgcResult {
884
+ itemId: bigint
885
+ needsToAcceptAgreement: boolean
886
+ }
887
+ export const enum UgcItemVisibility {
888
+ Public = 0,
889
+ FriendsOnly = 1,
890
+ Private = 2,
891
+ Unlisted = 3
892
+ }
893
+ export interface UgcUpdate {
894
+ title?: string
895
+ description?: string
896
+ changeNote?: string
897
+ previewPath?: string
898
+ /** Image files appended to the item's additional previews (screenshots). */
899
+ additionalPreviewPaths?: Array<string>
900
+ /** 0-based indexes of additional previews to remove, as listed in `additionalPreviews`. */
901
+ removeAdditionalPreviewIndexes?: Array<number>
902
+ contentPath?: string
903
+ tags?: Array<string>
904
+ visibility?: UgcItemVisibility
905
+ language?: string
906
+ }
907
+ export interface InstallInfo {
908
+ folder: string
909
+ sizeOnDisk: bigint
910
+ timestamp: number
911
+ }
912
+ export interface DownloadInfo {
913
+ current: bigint
914
+ total: bigint
915
+ }
916
+ export const enum UpdateStatus {
917
+ Invalid = 0,
918
+ PreparingConfig = 1,
919
+ PreparingContent = 2,
920
+ UploadingContent = 3,
921
+ UploadingPreviewFile = 4,
922
+ CommittingChanges = 5
923
+ }
924
+ export interface UpdateProgress {
925
+ status: UpdateStatus
926
+ progress: bigint
927
+ total: bigint
928
+ }
929
+ export function createItem(appId?: number | undefined | null): Promise<UgcResult>
930
+ export function updateItem(itemId: bigint, updateDetails: UgcUpdate, appId?: number | undefined | null): Promise<UgcResult>
931
+ /**
932
+ * Replace only the main preview image of a Workshop item.
933
+ *
934
+ * The mod content is not sent: nothing is uploaded from a content folder, and the title,
935
+ * description, tags and visibility stay as they are.
936
+ *
937
+ * @param itemId - the Workshop item to update
938
+ * @param previewPath - absolute path of an existing image file
939
+ * @param appId - defaults to the app id the client was initialized with
940
+ * @param changeNote - optional change note shown in the item's change history
941
+ */
942
+ export function updateItemPreview(itemId: bigint, previewPath: string, appId?: number | undefined | null, changeNote?: string | undefined | null): Promise<UgcResult>
943
+ /**
944
+ * Upload only the content folder of a Workshop item.
945
+ *
946
+ * The preview image is not touched, and the title, description, tags and visibility stay as
947
+ * they are.
948
+ *
949
+ * @param itemId - the Workshop item to update
950
+ * @param contentPath - absolute path of an existing folder with the mod files
951
+ * @param appId - defaults to the app id the client was initialized with
952
+ * @param changeNote - optional change note shown in the item's change history
953
+ */
954
+ export function updateItemContent(itemId: bigint, contentPath: string, appId?: number | undefined | null, changeNote?: string | undefined | null): Promise<UgcResult>
955
+ export function updateItemWithCallback(itemId: bigint, updateDetails: UgcUpdate, appId: number | undefined | null, successCallback: (data: UgcResult) => void, errorCallback: (err: any) => void, progressCallback?: (data: UpdateProgress) => void, progressCallbackIntervalMs?: number | undefined | null): void
956
+ /**
957
+ * Subscribe to a workshop item. It will be downloaded and installed as soon as possible.
958
+ *
959
+ * {@link https://partner.steamgames.com/doc/api/ISteamUGC#SubscribeItem}
960
+ */
961
+ export function subscribe(itemId: bigint): Promise<void>
962
+ /**
963
+ * Unsubscribe from a workshop item. This will result in the item being removed after the game quits.
964
+ *
965
+ * {@link https://partner.steamgames.com/doc/api/ISteamUGC#UnsubscribeItem}
966
+ */
967
+ export function unsubscribe(itemId: bigint): Promise<void>
968
+ /**
969
+ * Gets the current state of a workshop item on this client. States can be combined.
970
+ *
971
+ * @returns a number with the current item state, e.g. 9
972
+ * 9 = 1 (The current user is subscribed to this item) + 8 (The item needs an update)
973
+ *
974
+ * {@link https://partner.steamgames.com/doc/api/ISteamUGC#GetItemState}
975
+ * {@link https://partner.steamgames.com/doc/api/ISteamUGC#EItemState}
976
+ */
977
+ export function state(itemId: bigint): number
978
+ /**
979
+ * Gets info about currently installed content on the disc for workshop item.
980
+ *
981
+ * @returns an object with the the properties {folder, size_on_disk, timestamp}
982
+ *
983
+ * {@link https://partner.steamgames.com/doc/api/ISteamUGC#GetItemInstallInfo}
984
+ */
985
+ export function installInfo(itemId: bigint): InstallInfo | null
986
+ /**
987
+ * Get info about a pending download of a workshop item.
988
+ *
989
+ * @returns an object with the properties {current, total}
990
+ *
991
+ * {@link https://partner.steamgames.com/doc/api/ISteamUGC#GetItemDownloadInfo}
992
+ */
993
+ export function downloadInfo(itemId: bigint): DownloadInfo | null
994
+ /**
995
+ * Download or update a workshop item.
996
+ *
997
+ * @param highPriority - If high priority is true, start the download in high priority mode, pausing any existing in-progress Steam downloads and immediately begin downloading this workshop item.
998
+ * @returns true or false
999
+ *
1000
+ * {@link https://partner.steamgames.com/doc/api/ISteamUGC#DownloadItem}
1001
+ */
1002
+ export function download(itemId: bigint, highPriority: boolean): boolean
1003
+ /**
1004
+ * Get all subscribed workshop items.
1005
+ * @returns an array of subscribed workshop item ids
1006
+ */
1007
+ export function getSubscribedItems(): Array<bigint>
1008
+ export function deleteItem(itemId: bigint): Promise<void>
1009
+ /**
1010
+ * Marks `childId` as a required item of `parentId`. Resolves with the Steam result code, where `1` is
1011
+ * OK. A non-OK code (for example a missing child or a denied request) resolves rather than rejects.
1012
+ * Rejects on an invalid id (checked before any Steam call), an I/O failure, or a lost completion.
1013
+ */
1014
+ export function addDependency(parentId: bigint, childId: bigint): Promise<number>
1015
+ /**
1016
+ * Removes the required-item dependency from `parentId` to `childId`. Resolves with the Steam result
1017
+ * code (`1` is OK), with the same validation and rejection rules as `addDependency`.
1018
+ */
1019
+ export function removeDependency(parentId: bigint, childId: bigint): Promise<number>
1020
+ export const enum UGCQueryType {
1021
+ RankedByVote = 0,
1022
+ RankedByPublicationDate = 1,
1023
+ AcceptedForGameRankedByAcceptanceDate = 2,
1024
+ RankedByTrend = 3,
1025
+ FavoritedByFriendsRankedByPublicationDate = 4,
1026
+ CreatedByFriendsRankedByPublicationDate = 5,
1027
+ RankedByNumTimesReported = 6,
1028
+ CreatedByFollowedUsersRankedByPublicationDate = 7,
1029
+ NotYetRated = 8,
1030
+ RankedByTotalVotesAsc = 9,
1031
+ RankedByVotesUp = 10,
1032
+ RankedByTextSearch = 11,
1033
+ RankedByTotalUniqueSubscriptions = 12,
1034
+ RankedByPlaytimeTrend = 13,
1035
+ RankedByTotalPlaytime = 14,
1036
+ RankedByAveragePlaytimeTrend = 15,
1037
+ RankedByLifetimeAveragePlaytime = 16,
1038
+ RankedByPlaytimeSessionsTrend = 17,
1039
+ RankedByLifetimePlaytimeSessions = 18,
1040
+ RankedByLastUpdatedDate = 19
1041
+ }
1042
+ export const enum UGCType {
1043
+ Items = 0,
1044
+ ItemsMtx = 1,
1045
+ ItemsReadyToUse = 2,
1046
+ Collections = 3,
1047
+ Artwork = 4,
1048
+ Videos = 5,
1049
+ Screenshots = 6,
1050
+ AllGuides = 7,
1051
+ WebGuides = 8,
1052
+ IntegratedGuides = 9,
1053
+ UsableInGame = 10,
1054
+ ControllerBindings = 11,
1055
+ GameManagedItems = 12,
1056
+ All = 13
1057
+ }
1058
+ export const enum UserListType {
1059
+ Published = 0,
1060
+ VotedOn = 1,
1061
+ VotedUp = 2,
1062
+ VotedDown = 3,
1063
+ Favorited = 4,
1064
+ Subscribed = 5,
1065
+ UsedOrPlayed = 6,
1066
+ Followed = 7
1067
+ }
1068
+ export const enum UserListOrder {
1069
+ CreationOrderAsc = 0,
1070
+ CreationOrderDesc = 1,
1071
+ TitleAsc = 2,
1072
+ LastUpdatedDesc = 3,
1073
+ SubscriptionDateDesc = 4,
1074
+ VoteScoreDesc = 5,
1075
+ ForModeration = 6
1076
+ }
1077
+ export interface WorkshopItemStatistic {
1078
+ numSubscriptions?: bigint
1079
+ numFavorites?: bigint
1080
+ numFollowers?: bigint
1081
+ numUniqueSubscriptions?: bigint
1082
+ numUniqueFavorites?: bigint
1083
+ numUniqueFollowers?: bigint
1084
+ numUniqueWebsiteViews?: bigint
1085
+ reportScore?: bigint
1086
+ numSecondsPlayed?: bigint
1087
+ numPlaytimeSessions?: bigint
1088
+ numComments?: bigint
1089
+ numSecondsPlayedDuringTimePeriod?: bigint
1090
+ numPlaytimeSessionsDuringTimePeriod?: bigint
1091
+ }
1092
+ /**
1093
+ * Preview types for workshop item additional previews.
1094
+ * See: https://partner.steamgames.com/doc/api/ISteamUGC#EItemPreviewType
1095
+ */
1096
+ export const enum ItemPreviewType {
1097
+ /** Standard image file (e.g., jpg, png, gif, etc.) */
1098
+ Image = 0,
1099
+ /** YouTube video ID is stored */
1100
+ YouTubeVideo = 1,
1101
+ /** Sketchfab model ID is stored */
1102
+ Sketchfab = 2,
1103
+ /** Cube map in horizontal cross layout */
1104
+ EnvironmentMapHorizontalCross = 3,
1105
+ /** Environment map in latitude/longitude format */
1106
+ EnvironmentMapLatLong = 4,
1107
+ /** Clip ID is stored */
1108
+ Clip = 5,
1109
+ /** Reserved max value for custom types */
1110
+ ReservedMax = 255
1111
+ }
1112
+ /** Additional preview media for a workshop item. */
1113
+ export interface AdditionalPreview {
1114
+ /** URL or video ID for the preview (e.g., YouTube video ID, Sketchfab model ID, or image URL) */
1115
+ urlOrVideoId: string
1116
+ /** Original filename of the preview */
1117
+ originalFilename: string
1118
+ /** Type of preview (image, video, sketchfab model, etc.) */
1119
+ previewType: ItemPreviewType
1120
+ }
1121
+ export interface WorkshopItem {
1122
+ publishedFileId: bigint
1123
+ creatorAppId?: number
1124
+ consumerAppId?: number
1125
+ title: string
1126
+ description: string
1127
+ owner: PlayerSteamId
1128
+ /** Time created in unix epoch seconds format */
1129
+ timeCreated: number
1130
+ /** Time updated in unix epoch seconds format */
1131
+ timeUpdated: number
1132
+ /** Time when the user added the published item to their list (not always applicable), provided in Unix epoch format (time since Jan 1st, 1970). */
1133
+ timeAddedToUserList: number
1134
+ visibility: UgcItemVisibility
1135
+ banned: boolean
1136
+ acceptedForUse: boolean
1137
+ tags: Array<string>
1138
+ tagsTruncated: boolean
1139
+ url: string
1140
+ numUpvotes: number
1141
+ numDownvotes: number
1142
+ numChildren: number
1143
+ previewUrl?: string
1144
+ statistics: WorkshopItemStatistic
1145
+ children?: Array<bigint>
1146
+ /** Additional preview media (images, videos, etc.) for the workshop item */
1147
+ additionalPreviews?: Array<AdditionalPreview>
1148
+ }
1149
+ export interface WorkshopPaginatedResult {
1150
+ items: Array<WorkshopItem | undefined | null>
1151
+ returnedResults: number
1152
+ totalResults: number
1153
+ wasCached: boolean
1154
+ }
1155
+ export interface WorkshopItemsResult {
1156
+ items: Array<WorkshopItem | undefined | null>
1157
+ wasCached: boolean
1158
+ }
1159
+ export interface WorkshopItemQueryConfig {
1160
+ cachedResponseMaxAge?: number
1161
+ includeMetadata?: boolean
1162
+ includeLongDescription?: boolean
1163
+ includeAdditionalPreviews?: boolean
1164
+ onlyIds?: boolean
1165
+ onlyTotal?: boolean
1166
+ language?: string
1167
+ matchAnyTag?: boolean
1168
+ requiredTags?: Array<string>
1169
+ excludedTags?: Array<string>
1170
+ searchText?: string
1171
+ rankedByTrendDays?: number
1172
+ returnChildren?: boolean
1173
+ }
1174
+ export interface AppIDs {
1175
+ creator?: number
1176
+ consumer?: number
1177
+ }
1178
+ export function getItem(item: bigint, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopItem | null>
1179
+ export function getItems(items: Array<bigint>, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopItemsResult>
1180
+ export function getAllItems(page: number, queryType: UGCQueryType, itemType: UGCType, creatorAppId: number, consumerAppId: number, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopPaginatedResult>
1181
+ export function getUserItems(page: number, accountId: number, listType: UserListType, itemType: UGCType, sortOrder: UserListOrder, appIds: AppIDs, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopPaginatedResult>
1182
+ }