@hagicode/steamworks.js 0.1.6-dev.9 → 0.2.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/README.md +144 -20
- package/client.d.ts +713 -1
- package/dist/linux64/steamworksjs.linux-x64-gnu.node +0 -0
- package/dist/osx/steamworksjs.darwin-arm64.node +0 -0
- package/dist/osx/steamworksjs.darwin-x64.node +0 -0
- package/dist/win64/steamworksjs.win32-x64-msvc.node +0 -0
- package/package.json +65 -56
package/client.d.ts
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initializes the Steam client for this process and requests the user's stats. If a client already exists, it is dropped first.
|
|
3
|
+
* Needs the Steam client to be running. Throws an Error carrying Steam's reason when initialization fails.
|
|
4
|
+
* Unverified against a live Steam client: whether a logged-out Steam client initializes.
|
|
5
|
+
* @param appId - The Steam app ID to initialize as. Omit it to use the app ID the SDK resolves on its own (for example from `steam_appid.txt`).
|
|
6
|
+
*/
|
|
1
7
|
export declare function init(appId?: number | undefined | null): void
|
|
8
|
+
/**
|
|
9
|
+
* Checks whether Steam must relaunch this app. Does not need `init()`.
|
|
10
|
+
* Returns true when the app was not started by Steam and has no `steam_appid.txt`. Steam then starts the app through its client, and the app should exit as soon as possible. Returns false when Steam launched the app or `steam_appid.txt` is present.
|
|
11
|
+
* @param appId - The Steam app ID of the game.
|
|
12
|
+
* @returns true if Steam is relaunching the app and it should quit, otherwise false.
|
|
13
|
+
*/
|
|
2
14
|
export declare function restartAppIfNecessary(appId: number): boolean
|
|
15
|
+
/**
|
|
16
|
+
* Dispatches pending Steam callbacks and call results to the handlers registered with `register()` and to pending async calls. Call it regularly, for example once per frame or on a timer, or events are delayed.
|
|
17
|
+
* Does nothing before `init()` or after `shutdown()`.
|
|
18
|
+
*/
|
|
3
19
|
export declare function runCallbacks(): void
|
|
20
|
+
/**
|
|
21
|
+
* Releases the Steam client, which shuts down the Steam API. Safe to call when no client exists.
|
|
22
|
+
* After this call `isConnected()` returns false, and `init()` must run again before other Steam APIs are used.
|
|
23
|
+
*/
|
|
4
24
|
export declare function shutdown(): void
|
|
25
|
+
/**
|
|
26
|
+
* Returns whether a Steam client is held, meaning `init()` succeeded and `shutdown()` has not been called since. Does not check that the Steam client is running or that a user is logged in.
|
|
27
|
+
* @returns true if the client is initialized, otherwise false.
|
|
28
|
+
*/
|
|
5
29
|
export declare function isConnected(): boolean
|
|
6
30
|
export interface PlayerSteamId {
|
|
7
31
|
steamId64: bigint
|
|
@@ -9,9 +33,30 @@ export interface PlayerSteamId {
|
|
|
9
33
|
accountId: number
|
|
10
34
|
}
|
|
11
35
|
export declare namespace achievement {
|
|
36
|
+
/**
|
|
37
|
+
* Unlocks an achievement and stores the change to Steam. Needs `init()`, which requests the user's stats.
|
|
38
|
+
* Returns true when Steam accepted both the unlock and the store request. The store finishes asynchronously, and its result arrives through the UserStatsStored callback while `runCallbacks()` runs.
|
|
39
|
+
* @param achievement - The achievement API name as configured in Steamworks.
|
|
40
|
+
* @returns true if the request was accepted, otherwise false (for example an unknown name, or stats that Steam has not received yet).
|
|
41
|
+
*/
|
|
12
42
|
export function activate(achievement: string): boolean
|
|
43
|
+
/**
|
|
44
|
+
* Checks whether the user has unlocked an achievement. Needs `init()`, which requests the user's stats.
|
|
45
|
+
* @param achievement - The achievement API name as configured in Steamworks.
|
|
46
|
+
* @returns true if unlocked, otherwise false. False is also returned when the lookup fails (unknown name, or stats not received yet), so a failed lookup cannot be told apart from a locked achievement.
|
|
47
|
+
*/
|
|
13
48
|
export function isActivated(achievement: string): boolean
|
|
49
|
+
/**
|
|
50
|
+
* Re-locks an achievement and stores the change to Steam. Same requirements as `activate()`.
|
|
51
|
+
* @param achievement - The achievement API name as configured in Steamworks.
|
|
52
|
+
* @returns true if Steam accepted both the clear and the store request, otherwise false.
|
|
53
|
+
*/
|
|
14
54
|
export function clear(achievement: string): boolean
|
|
55
|
+
/**
|
|
56
|
+
* Returns the API names of all achievements defined for the app. Needs `init()`.
|
|
57
|
+
* Fails when Steam returns no list; the binding then panics. Unverified against a live Steam client: how that failure reaches JavaScript.
|
|
58
|
+
* @returns the achievement API names defined for the app.
|
|
59
|
+
*/
|
|
15
60
|
export function names(): Array<string>
|
|
16
61
|
/**
|
|
17
62
|
* Fetches the global unlock percentages of every achievement. Resolves once Steam has answered;
|
|
@@ -25,19 +70,79 @@ export declare namespace achievement {
|
|
|
25
70
|
export function getAchievedPercent(achievement: string): number | null
|
|
26
71
|
}
|
|
27
72
|
export declare namespace apps {
|
|
73
|
+
/**
|
|
74
|
+
* 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.
|
|
75
|
+
* @param appId - The Steam app ID to check.
|
|
76
|
+
* @returns true if the user is subscribed to the app, otherwise false.
|
|
77
|
+
*/
|
|
28
78
|
export function isSubscribedApp(appId: number): boolean
|
|
79
|
+
/**
|
|
80
|
+
* Checks whether the app is installed for the current user. An installed app does not mean the user owns it.
|
|
81
|
+
* @param appId - The Steam app ID to check.
|
|
82
|
+
* @returns true if the app is currently installed, otherwise false.
|
|
83
|
+
*/
|
|
29
84
|
export function isAppInstalled(appId: number): boolean
|
|
85
|
+
/**
|
|
86
|
+
* Checks whether the user owns the DLC and has it installed.
|
|
87
|
+
* @param appId - The Steam app ID of the DLC.
|
|
88
|
+
* @returns true if the DLC is owned and installed, otherwise false.
|
|
89
|
+
*/
|
|
30
90
|
export function isDlcInstalled(appId: number): boolean
|
|
91
|
+
/**
|
|
92
|
+
* Checks whether the user is subscribed through a free weekend.
|
|
93
|
+
* @returns true if so, otherwise false.
|
|
94
|
+
*/
|
|
31
95
|
export function isSubscribedFromFreeWeekend(): boolean
|
|
96
|
+
/**
|
|
97
|
+
* Checks whether the user's account has a VAC ban.
|
|
98
|
+
* @returns true if the account is VAC banned, otherwise false.
|
|
99
|
+
*/
|
|
32
100
|
export function isVacBanned(): boolean
|
|
101
|
+
/**
|
|
102
|
+
* Checks whether the license for the current app is a cyber cafe license.
|
|
103
|
+
* @returns true if it is, otherwise false.
|
|
104
|
+
*/
|
|
33
105
|
export function isCybercafe(): boolean
|
|
106
|
+
/**
|
|
107
|
+
* Checks whether the license for the current app provides low violence depots.
|
|
108
|
+
* @returns true if it does, otherwise false.
|
|
109
|
+
*/
|
|
34
110
|
export function isLowViolence(): boolean
|
|
111
|
+
/**
|
|
112
|
+
* Checks whether the user is subscribed to the current app.
|
|
113
|
+
* @returns true if subscribed, otherwise false.
|
|
114
|
+
*/
|
|
35
115
|
export function isSubscribed(): boolean
|
|
116
|
+
/**
|
|
117
|
+
* Returns the build ID of the current app as Steam reports it.
|
|
118
|
+
* @returns the build ID as a signed 32-bit integer.
|
|
119
|
+
*/
|
|
36
120
|
export function appBuildId(): number
|
|
121
|
+
/**
|
|
122
|
+
* Returns the install folder of an app. Works even when the app is not installed, returning the folder it would use in the default location.
|
|
123
|
+
* @param appId - The Steam app ID to look up.
|
|
124
|
+
* @returns the install folder path.
|
|
125
|
+
*/
|
|
37
126
|
export function appInstallDir(appId: number): string
|
|
127
|
+
/**
|
|
128
|
+
* Returns the original owner of the current app. It differs from the current user only when the app is borrowed.
|
|
129
|
+
* @returns the owner as a PlayerSteamId with `steamId64`, `steamId32` and `accountId` fields.
|
|
130
|
+
*/
|
|
38
131
|
export function appOwner(): PlayerSteamId
|
|
132
|
+
/**
|
|
133
|
+
* Returns the languages the current app supports.
|
|
134
|
+
* @returns the language names as Steam reports them, or an empty array when none are listed.
|
|
135
|
+
*/
|
|
39
136
|
export function availableGameLanguages(): Array<string>
|
|
137
|
+
/**
|
|
138
|
+
* Returns the language the user has set for the current game. If the user has not set one, Steam returns the language of the Steam UI.
|
|
139
|
+
* @returns the language name as Steam reports it.
|
|
140
|
+
*/
|
|
40
141
|
export function currentGameLanguage(): string
|
|
142
|
+
/**
|
|
143
|
+
* Returns the beta branch the user is on for the current app.
|
|
144
|
+
* @returns the beta branch name, or `null` when the user is on the default branch.
|
|
145
|
+
*/
|
|
41
146
|
export function currentBetaName(): string | null
|
|
42
147
|
/** @returns the command line the game was launched with, or an empty string */
|
|
43
148
|
export function launchCommandLine(): string
|
|
@@ -55,9 +160,21 @@ export declare namespace auth {
|
|
|
55
160
|
* @param timeoutSeconds - The number of seconds to wait for the ticket to be validated. Default value is 10 seconds.
|
|
56
161
|
*/
|
|
57
162
|
export function getSessionTicketWithIp(ip: string, timeoutSeconds?: number | undefined | null): Promise<Ticket>
|
|
163
|
+
/**
|
|
164
|
+
* Requests an auth session ticket for a Steam Web API service and waits for Steam to validate it. Needs `init()`.
|
|
165
|
+
* Rejects with Steam's error on failure, or with "Steam didn't validated the ticket in time." when Steam does not answer within the timeout. The ticket is cancelled in both cases. Call `cancel()` on the returned Ticket once the remote side no longer needs it.
|
|
166
|
+
* @param identity - The identity string of the Web API service that will validate the ticket.
|
|
167
|
+
* @param timeoutSeconds - Seconds to wait for Steam before rejecting. Defaults to 10.
|
|
168
|
+
* @returns a Ticket holding the ticket bytes, readable with `getBytes()`.
|
|
169
|
+
*/
|
|
58
170
|
export function getAuthTicketForWebApi(identity: string, timeoutSeconds?: number | undefined | null): Promise<Ticket>
|
|
59
171
|
export class Ticket {
|
|
172
|
+
/** Cancels the auth ticket with Steam so it can no longer be used. Call it only while the Steam client is initialized. */
|
|
60
173
|
cancel(): void
|
|
174
|
+
/**
|
|
175
|
+
* Returns a copy of the ticket bytes. Does not call Steam.
|
|
176
|
+
* @returns the ticket as a Buffer, to send to the service that validates it.
|
|
177
|
+
*/
|
|
61
178
|
getBytes(): Buffer
|
|
62
179
|
}
|
|
63
180
|
}
|
|
@@ -87,19 +204,66 @@ export declare namespace callback {
|
|
|
87
204
|
AuthSessionTicketResponse = 21,
|
|
88
205
|
ValidateAuthTicketResponse = 22
|
|
89
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Registers a handler for a Steam callback. Needs `init()`.
|
|
209
|
+
* The handler receives each callback payload as a JSON-compatible value on the JavaScript event loop. Steam events are dispatched only while `runCallbacks()` runs.
|
|
210
|
+
* @param steamCallback - The callback kind to listen for.
|
|
211
|
+
* @param handler - Called with each payload of that callback.
|
|
212
|
+
* @returns a Handle; call `disconnect()` on it to stop the handler.
|
|
213
|
+
*/
|
|
90
214
|
export function register<C extends keyof import('./callbacks').CallbackReturns>(steamCallback: C, handler: (value: import('./callbacks').CallbackReturns[C]) => void): Handle
|
|
91
215
|
export class Handle {
|
|
216
|
+
/** Stops the handler registered for this Handle from being called. Calling it again does nothing. */
|
|
92
217
|
disconnect(): void
|
|
93
218
|
}
|
|
94
219
|
}
|
|
95
220
|
export declare namespace cloud {
|
|
221
|
+
/**
|
|
222
|
+
* Checks whether Steam Cloud is enabled for the user's account. This is separate from the app setting (`isEnabledForApp()`).
|
|
223
|
+
* @returns true if enabled for the account, otherwise false.
|
|
224
|
+
*/
|
|
96
225
|
export function isEnabledForAccount(): boolean
|
|
226
|
+
/**
|
|
227
|
+
* Checks whether Steam Cloud is enabled for the current app. This is separate from the account setting (`isEnabledForAccount()`).
|
|
228
|
+
* @returns true if enabled for the app, otherwise false.
|
|
229
|
+
*/
|
|
97
230
|
export function isEnabledForApp(): boolean
|
|
231
|
+
/**
|
|
232
|
+
* Turns Steam Cloud on or off for the current app. It does not change the account setting. Returns nothing, and the binding does not report whether Steam applied the change.
|
|
233
|
+
* @param enabled - true to enable Steam Cloud for the app, false to disable it.
|
|
234
|
+
*/
|
|
98
235
|
export function setEnabledForApp(enabled: boolean): void
|
|
236
|
+
/**
|
|
237
|
+
* Reads a Steam Cloud file as UTF-8 text. Needs `init()`.
|
|
238
|
+
* Rejects with "Failed to read file" when the file cannot be read or its bytes are not valid UTF-8. Unverified against a live Steam client: a missing file is read as empty text on this code path.
|
|
239
|
+
* @param name - The cloud file name.
|
|
240
|
+
* @returns the file content as a string.
|
|
241
|
+
*/
|
|
99
242
|
export function readFile(name: string): string
|
|
243
|
+
/**
|
|
244
|
+
* Writes text to a Steam Cloud file as UTF-8, replacing its previous content. Needs `init()`.
|
|
245
|
+
* The write is committed when the write stream closes, which happens before this call returns.
|
|
246
|
+
* @param name - The cloud file name.
|
|
247
|
+
* @param content - Text to write, encoded as UTF-8.
|
|
248
|
+
* @returns true if the content was accepted by the write stream, false if writing failed. The commit result is not reported. Unverified against a live Steam client whether a failed commit is visible.
|
|
249
|
+
*/
|
|
100
250
|
export function writeFile(name: string, content: string): boolean
|
|
251
|
+
/**
|
|
252
|
+
* Deletes a Steam Cloud file both locally and in the cloud. Needs `init()`.
|
|
253
|
+
* @param name - The cloud file name.
|
|
254
|
+
* @returns true if a file was deleted, false if none was.
|
|
255
|
+
*/
|
|
101
256
|
export function deleteFile(name: string): boolean
|
|
257
|
+
/**
|
|
258
|
+
* Checks whether a Steam Cloud file exists. Needs `init()`.
|
|
259
|
+
* @param name - The cloud file name.
|
|
260
|
+
* @returns true if the file exists, otherwise false.
|
|
261
|
+
*/
|
|
102
262
|
export function fileExists(name: string): boolean
|
|
263
|
+
/**
|
|
264
|
+
* Lists the Steam Cloud files of the current app. Needs `init()`.
|
|
265
|
+
* @returns an array of entries with `name` and `size` fields, where size is the file size in bytes as a BigInt. The array is empty when there are no files.
|
|
266
|
+
*/
|
|
103
267
|
export function listFiles(): Array<FileInfo>
|
|
104
268
|
/** The platforms a cloud file syncs to. */
|
|
105
269
|
export const enum SyncPlatform {
|
|
@@ -156,9 +320,20 @@ export declare namespace friends {
|
|
|
156
320
|
export function getFriends(flags: number): Array<FriendInfo>
|
|
157
321
|
/** Players the local user has recently played with. */
|
|
158
322
|
export function getCoplayFriends(): Array<FriendInfo>
|
|
323
|
+
/**
|
|
324
|
+
* Returns the online state of a friend as the local Steam client knows it.
|
|
325
|
+
* Requires a running Steam client.
|
|
326
|
+
* @param steamId64 - SteamID64 of the friend, as a BigInt
|
|
327
|
+
* @returns the friend's `FriendState`
|
|
328
|
+
*/
|
|
159
329
|
export function getFriendState(steamId64: bigint): FriendState
|
|
160
330
|
/** @returns the AppID of the game the friend is playing, or `null` when they are not in a game */
|
|
161
331
|
export function getFriendGamePlayed(steamId64: bigint): number | null
|
|
332
|
+
/**
|
|
333
|
+
* Returns the most recent co-play record between the local user and a friend.
|
|
334
|
+
* @param steamId64 - SteamID64 of the friend, as a BigInt
|
|
335
|
+
* @returns `appId` of the game played together (`0` when there is none) and `time`, the seconds since they last played together
|
|
336
|
+
*/
|
|
162
337
|
export function getFriendCoplayInfo(steamId64: bigint): CoplayInfo
|
|
163
338
|
/** @returns the small (32x32) avatar as RGBA pixels, or `null` when it has not been loaded */
|
|
164
339
|
export function getSmallAvatar(steamId64: bigint): Buffer | null
|
|
@@ -197,11 +372,36 @@ export declare namespace input {
|
|
|
197
372
|
x: number
|
|
198
373
|
y: number
|
|
199
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Initializes Steam Input. Call it before reading controllers or action data.
|
|
377
|
+
* Steam Input is updated from the Steam callback loop (`SteamAPI_RunCallbacks()`), not by a separate per-frame call.
|
|
378
|
+
* Requires a running Steam client.
|
|
379
|
+
*/
|
|
200
380
|
export function init(): void
|
|
381
|
+
/**
|
|
382
|
+
* Lists the controllers Steam Input currently sees as connected.
|
|
383
|
+
* @returns a `Controller` for each connected controller, or an empty array when none are connected
|
|
384
|
+
*/
|
|
201
385
|
export function getControllers(): Array<Controller>
|
|
386
|
+
/**
|
|
387
|
+
* Looks up the handle of an action set defined in the game's Steam Input configuration.
|
|
388
|
+
* @param actionSetName - name of the action set, as it is defined in the Steam Input configuration
|
|
389
|
+
* @returns the action set handle as a BigInt. Unverified against a live Steam client: a name that is not found is expected to return `0`.
|
|
390
|
+
*/
|
|
202
391
|
export function getActionSet(actionSetName: string): bigint
|
|
392
|
+
/**
|
|
393
|
+
* Looks up the handle of a digital action defined in the game's Steam Input configuration.
|
|
394
|
+
* @param actionName - name of the digital action, as it is defined in the Steam Input configuration
|
|
395
|
+
* @returns the action handle as a BigInt. Unverified against a live Steam client: a name that is not found is expected to return `0`.
|
|
396
|
+
*/
|
|
203
397
|
export function getDigitalAction(actionName: string): bigint
|
|
398
|
+
/**
|
|
399
|
+
* Looks up the handle of an analog action defined in the game's Steam Input configuration.
|
|
400
|
+
* @param actionName - name of the analog action, as it is defined in the Steam Input configuration
|
|
401
|
+
* @returns the action handle as a BigInt. Unverified against a live Steam client: a name that is not found is expected to return `0`.
|
|
402
|
+
*/
|
|
204
403
|
export function getAnalogAction(actionName: string): bigint
|
|
404
|
+
/** Shuts down Steam Input. Call `init` again before using controllers or actions after this. */
|
|
205
405
|
export function shutdown(): void
|
|
206
406
|
export interface DigitalActionData {
|
|
207
407
|
/** `true` while the digital action is pressed. */
|
|
@@ -231,10 +431,32 @@ export declare namespace input {
|
|
|
231
431
|
/** @returns the glyph image path of an action origin */
|
|
232
432
|
export function getGlyphForActionOrigin(origin: number): string
|
|
233
433
|
export class Controller {
|
|
434
|
+
/**
|
|
435
|
+
* Switches this controller to an action set. The call is cheap and can be repeated safely.
|
|
436
|
+
* @param actionSetHandle - action set handle from `getActionSet`
|
|
437
|
+
*/
|
|
234
438
|
activateActionSet(actionSetHandle: bigint): void
|
|
439
|
+
/**
|
|
440
|
+
* Checks whether a digital action is pressed on this controller.
|
|
441
|
+
* @param actionHandle - digital action handle from `getDigitalAction`
|
|
442
|
+
* @returns `true` while the action is pressed, otherwise `false`
|
|
443
|
+
*/
|
|
235
444
|
isDigitalActionPressed(actionHandle: bigint): boolean
|
|
445
|
+
/**
|
|
446
|
+
* Reads the current vector of an analog action on this controller.
|
|
447
|
+
* @param actionHandle - analog action handle from `getAnalogAction`
|
|
448
|
+
* @returns `x` and `y` as reported by Steam Input. Unverified against a live Steam client: the value ranges are not checked here.
|
|
449
|
+
*/
|
|
236
450
|
getAnalogActionVector(actionHandle: bigint): AnalogActionVector
|
|
451
|
+
/**
|
|
452
|
+
* Identifies the type of this controller.
|
|
453
|
+
* @returns the controller's `InputType`, `Unknown` when Steam cannot identify it
|
|
454
|
+
*/
|
|
237
455
|
getType(): InputType
|
|
456
|
+
/**
|
|
457
|
+
* Returns the Steam Input handle of this controller.
|
|
458
|
+
* @returns the handle as a BigInt, the value used by controller-scoped Steam Input calls
|
|
459
|
+
*/
|
|
238
460
|
getHandle(): bigint
|
|
239
461
|
}
|
|
240
462
|
}
|
|
@@ -309,11 +531,28 @@ export declare namespace leaderboard {
|
|
|
309
531
|
}
|
|
310
532
|
}
|
|
311
533
|
export declare namespace localplayer {
|
|
534
|
+
/**
|
|
535
|
+
* Returns the SteamID of the logged-in local user. Requires a running, logged-in Steam client.
|
|
536
|
+
* @returns `steamId64` as a BigInt, `steamId32` as a string, and `accountId`
|
|
537
|
+
*/
|
|
312
538
|
export function getSteamId(): PlayerSteamId
|
|
539
|
+
/**
|
|
540
|
+
* Returns the Steam display name of the local user. Requires a running Steam client.
|
|
541
|
+
* @returns the persona name
|
|
542
|
+
*/
|
|
313
543
|
export function getName(): string
|
|
544
|
+
/**
|
|
545
|
+
* Returns the Steam level of the local user. Requires a running Steam client.
|
|
546
|
+
* @returns the Steam level
|
|
547
|
+
*/
|
|
314
548
|
export function getLevel(): number
|
|
315
549
|
/** @returns the 2 digit ISO 3166-1-alpha-2 format country code which client is running in, e.g. "US" or "UK". */
|
|
316
550
|
export function getIpCountry(): string
|
|
551
|
+
/**
|
|
552
|
+
* Sets one Rich Presence value for the local user, visible to friends.
|
|
553
|
+
* @param key - Rich Presence key
|
|
554
|
+
* @param value - value to set; `null` or omitted removes the key
|
|
555
|
+
*/
|
|
317
556
|
export function setRichPresence(key: string, value?: string | undefined | null): void
|
|
318
557
|
}
|
|
319
558
|
export declare namespace matchmaking {
|
|
@@ -323,21 +562,79 @@ export declare namespace matchmaking {
|
|
|
323
562
|
Public = 2,
|
|
324
563
|
Invisible = 3
|
|
325
564
|
}
|
|
565
|
+
/**
|
|
566
|
+
* Creates a new lobby and makes the local user its owner.
|
|
567
|
+
* @param lobbyType - visibility of the lobby
|
|
568
|
+
* @param maxMembers - maximum number of members; Steam rejects values above 250
|
|
569
|
+
* @returns the new `Lobby`; rejects with Steam's error text when creation fails
|
|
570
|
+
*/
|
|
326
571
|
export function createLobby(lobbyType: LobbyType, maxMembers: number): Promise<Lobby>
|
|
572
|
+
/**
|
|
573
|
+
* Joins a lobby by its ID.
|
|
574
|
+
* @param lobbyId - lobby ID as a BigInt
|
|
575
|
+
* @returns the joined `Lobby`; rejects with `Failed to join lobby` when Steam refuses the join
|
|
576
|
+
*/
|
|
327
577
|
export function joinLobby(lobbyId: bigint): Promise<Lobby>
|
|
578
|
+
/**
|
|
579
|
+
* Requests the lobby list from Steam. The list follows the filters Steam applies by default. Unverified against a live Steam client.
|
|
580
|
+
* @returns a `Lobby` for each lobby in the result; rejects with an error when the request fails
|
|
581
|
+
*/
|
|
328
582
|
export function getLobbies(): Promise<Array<Lobby>>
|
|
329
583
|
export class Lobby {
|
|
330
584
|
id: bigint
|
|
585
|
+
/**
|
|
586
|
+
* Joins this lobby.
|
|
587
|
+
* @returns a `Lobby` for the joined lobby; rejects with `Failed to join lobby` when Steam refuses the join
|
|
588
|
+
*/
|
|
331
589
|
join(): Promise<Lobby>
|
|
590
|
+
/** Leaves this lobby. */
|
|
332
591
|
leave(): void
|
|
592
|
+
/** Opens the Steam invite dialog for this lobby. */
|
|
333
593
|
openInviteDialog(): void
|
|
594
|
+
/**
|
|
595
|
+
* Returns the number of members currently in this lobby.
|
|
596
|
+
* @returns the member count
|
|
597
|
+
*/
|
|
334
598
|
getMemberCount(): bigint
|
|
599
|
+
/**
|
|
600
|
+
* Returns the maximum number of members this lobby allows.
|
|
601
|
+
* @returns the member limit, or `null` when Steam has no metadata for the lobby
|
|
602
|
+
*/
|
|
335
603
|
getMemberLimit(): bigint | null
|
|
604
|
+
/**
|
|
605
|
+
* Returns the members of this lobby.
|
|
606
|
+
* @returns a `PlayerSteamId` for each member, empty when there are none
|
|
607
|
+
*/
|
|
336
608
|
getMembers(): Array<PlayerSteamId>
|
|
609
|
+
/**
|
|
610
|
+
* Returns the owner of this lobby.
|
|
611
|
+
* @returns the owner's `PlayerSteamId`
|
|
612
|
+
*/
|
|
337
613
|
getOwner(): PlayerSteamId
|
|
614
|
+
/**
|
|
615
|
+
* Sets whether new users may join this lobby. Only the lobby owner can change this.
|
|
616
|
+
* @param joinable - `true` to allow joining, `false` to block it
|
|
617
|
+
* @returns `true` when Steam accepted the change
|
|
618
|
+
*/
|
|
338
619
|
setJoinable(joinable: boolean): boolean
|
|
620
|
+
/**
|
|
621
|
+
* Reads one metadata value of this lobby.
|
|
622
|
+
* @param key - metadata key
|
|
623
|
+
* @returns the value, or `null` when the key is not set
|
|
624
|
+
*/
|
|
339
625
|
getData(key: string): string | null
|
|
626
|
+
/**
|
|
627
|
+
* Sets one metadata value of this lobby. Only the lobby owner can set lobby data.
|
|
628
|
+
* @param key - metadata key
|
|
629
|
+
* @param value - value to store
|
|
630
|
+
* @returns `true` when Steam accepted the change
|
|
631
|
+
*/
|
|
340
632
|
setData(key: string, value: string): boolean
|
|
633
|
+
/**
|
|
634
|
+
* Deletes one metadata value of this lobby. Only the lobby owner can delete lobby data.
|
|
635
|
+
* @param key - metadata key to delete
|
|
636
|
+
* @returns `true` when Steam accepted the change
|
|
637
|
+
*/
|
|
341
638
|
deleteData(key: string): boolean
|
|
342
639
|
/** Get an object containing all the lobby data */
|
|
343
640
|
getFullData(): Record<string, string>
|
|
@@ -451,10 +748,38 @@ export declare namespace networking {
|
|
|
451
748
|
*/
|
|
452
749
|
ReliableWithBuffering = 3
|
|
453
750
|
}
|
|
751
|
+
/**
|
|
752
|
+
* Sends a packet to another user over Steam peer-to-peer networking.
|
|
753
|
+
* @param steamId64 - recipient SteamID64 as a BigInt
|
|
754
|
+
* @param sendType - delivery mode; each mode has its own size limit
|
|
755
|
+
* @param data - packet payload
|
|
756
|
+
* @returns `true` when Steam queued the packet
|
|
757
|
+
*/
|
|
454
758
|
export function sendP2PPacket(steamId64: bigint, sendType: SendType, data: Buffer): boolean
|
|
759
|
+
/**
|
|
760
|
+
* Checks whether a packet is waiting to be read on channel 0.
|
|
761
|
+
* @returns the size in bytes of the next packet, or `0` when none is waiting
|
|
762
|
+
*/
|
|
455
763
|
export function isP2PPacketAvailable(): number
|
|
764
|
+
/**
|
|
765
|
+
* Reads the next waiting packet on channel 0.
|
|
766
|
+
* @param size - size of the receive buffer in bytes
|
|
767
|
+
* @returns `data` (the buffer), `size` (bytes read) and `steamId` of the sender; rejects with `No packet available` when none is waiting
|
|
768
|
+
*/
|
|
456
769
|
export function readP2PPacket(size: number): P2PPacket
|
|
770
|
+
/**
|
|
771
|
+
* Accepts a peer-to-peer session request from a user. Call it in response to a session request from that user.
|
|
772
|
+
* @param steamId64 - SteamID64 of the user as a BigInt
|
|
773
|
+
*/
|
|
457
774
|
export function acceptP2PSession(steamId64: bigint): void
|
|
775
|
+
/**
|
|
776
|
+
* Sends a packet to another user on a specific channel. Each channel is an independent stream.
|
|
777
|
+
* @param steamId64 - recipient SteamID64 as a BigInt
|
|
778
|
+
* @param sendType - delivery mode; each mode has its own size limit
|
|
779
|
+
* @param data - packet payload
|
|
780
|
+
* @param channel - channel number
|
|
781
|
+
* @returns `true` when Steam queued the packet
|
|
782
|
+
*/
|
|
458
783
|
export function sendP2PPacketOnChannel(steamId64: bigint, sendType: SendType, data: Buffer, channel: number): boolean
|
|
459
784
|
/** @returns the size of the next packet on the channel, or 0 when none is waiting */
|
|
460
785
|
export function isP2PPacketAvailableOnChannel(channel: number): number
|
|
@@ -747,23 +1072,55 @@ export declare namespace networkingUtils {
|
|
|
747
1072
|
}
|
|
748
1073
|
export declare namespace overlay {
|
|
749
1074
|
export const enum Dialog {
|
|
1075
|
+
/** Friends list dialog. */
|
|
750
1076
|
Friends = 0,
|
|
1077
|
+
/** Steam Community dialog. */
|
|
751
1078
|
Community = 1,
|
|
1079
|
+
/** Recent players dialog. */
|
|
752
1080
|
Players = 2,
|
|
1081
|
+
/** Steam settings dialog. */
|
|
753
1082
|
Settings = 3,
|
|
1083
|
+
/** Official group of the game. */
|
|
754
1084
|
OfficialGameGroup = 4,
|
|
1085
|
+
/** Game statistics dialog. */
|
|
755
1086
|
Stats = 5,
|
|
1087
|
+
/** Achievements dialog. */
|
|
756
1088
|
Achievements = 6
|
|
757
1089
|
}
|
|
758
1090
|
export const enum StoreFlag {
|
|
1091
|
+
/** Open the store page without adding the app to the cart. */
|
|
759
1092
|
None = 0,
|
|
1093
|
+
/** Add the app to the cart without showing the cart. */
|
|
760
1094
|
AddToCart = 1,
|
|
1095
|
+
/** Add the app to the cart and show the cart. */
|
|
761
1096
|
AddToCartAndShow = 2
|
|
762
1097
|
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Opens a Steam overlay dialog. Unverified against a live Steam client: nothing is shown when the overlay is disabled.
|
|
1100
|
+
* @param dialog - dialog to open
|
|
1101
|
+
*/
|
|
763
1102
|
export function activateDialog(dialog: Dialog): void
|
|
1103
|
+
/**
|
|
1104
|
+
* Opens a Steam overlay dialog for a specific user. Unverified against a live Steam client.
|
|
1105
|
+
* @param dialog - dialog to open
|
|
1106
|
+
* @param steamId64 - SteamID64 of the user as a BigInt
|
|
1107
|
+
*/
|
|
764
1108
|
export function activateDialogToUser(dialog: Dialog, steamId64: bigint): void
|
|
1109
|
+
/**
|
|
1110
|
+
* Opens the Steam invite dialog for a lobby.
|
|
1111
|
+
* @param lobbyId - lobby ID as a BigInt
|
|
1112
|
+
*/
|
|
765
1113
|
export function activateInviteDialog(lobbyId: bigint): void
|
|
1114
|
+
/**
|
|
1115
|
+
* Opens a web page in the Steam overlay browser. Unverified against a live Steam client.
|
|
1116
|
+
* @param url - absolute URL to open
|
|
1117
|
+
*/
|
|
766
1118
|
export function activateToWebPage(url: string): void
|
|
1119
|
+
/**
|
|
1120
|
+
* Opens the Steam store page of an app in the overlay.
|
|
1121
|
+
* @param appId - AppID of the app to show
|
|
1122
|
+
* @param flag - whether to add the app to the cart, and whether to show the cart
|
|
1123
|
+
*/
|
|
767
1124
|
export function activateToStore(appId: number, flag: StoreFlag): void
|
|
768
1125
|
}
|
|
769
1126
|
export declare namespace remotePlay {
|
|
@@ -802,6 +1159,10 @@ export declare namespace remotePlay {
|
|
|
802
1159
|
export declare namespace screenshots {
|
|
803
1160
|
/** Turns the Steam screenshot hotkey into a `ScreenshotRequested` callback, so the game takes the screenshot itself. */
|
|
804
1161
|
export function hookScreenshots(hook: boolean): void
|
|
1162
|
+
/**
|
|
1163
|
+
* Checks whether the screenshot hotkey is currently hooked by the game (see `hookScreenshots`).
|
|
1164
|
+
* @returns `true` when hooked, otherwise `false`
|
|
1165
|
+
*/
|
|
805
1166
|
export function isScreenshotsHooked(): boolean
|
|
806
1167
|
/** Triggers a screenshot, the same as the player pressing the screenshot hotkey. */
|
|
807
1168
|
export function triggerScreenshot(): void
|
|
@@ -812,9 +1173,29 @@ export declare namespace screenshots {
|
|
|
812
1173
|
export function addScreenshotToLibrary(filename: string, thumbnailFilename: string | undefined | null, width: number, height: number): number
|
|
813
1174
|
}
|
|
814
1175
|
export declare namespace stats {
|
|
1176
|
+
/**
|
|
1177
|
+
* Reads an integer stat of the local user from the locally loaded stats. Unverified against a live Steam client: the stats must be loaded first.
|
|
1178
|
+
* @param name - stat name as defined in the Steamworks site
|
|
1179
|
+
* @returns the stat value, or `null` when the stat is missing or not loaded
|
|
1180
|
+
*/
|
|
815
1181
|
export function getInt(name: string): number | null
|
|
1182
|
+
/**
|
|
1183
|
+
* Sets an integer stat of the local user. The value is not sent to Steam until `store()` is called.
|
|
1184
|
+
* @param name - stat name as defined in the Steamworks site
|
|
1185
|
+
* @param value - 32-bit signed integer
|
|
1186
|
+
* @returns `true` when Steam accepted the change, otherwise `false`
|
|
1187
|
+
*/
|
|
816
1188
|
export function setInt(name: string, value: number): boolean
|
|
1189
|
+
/**
|
|
1190
|
+
* Sends the pending stat and achievement changes of the local user to Steam. The request is asynchronous, so `true` only means Steam accepted it.
|
|
1191
|
+
* @returns `true` when Steam accepted the request, otherwise `false`
|
|
1192
|
+
*/
|
|
817
1193
|
export function store(): boolean
|
|
1194
|
+
/**
|
|
1195
|
+
* Resets all stats of the local user. This cannot be undone from this binding.
|
|
1196
|
+
* @param achievementsToo - `true` also clears the user's achievements
|
|
1197
|
+
* @returns `true` when Steam accepted the reset, otherwise `false`
|
|
1198
|
+
*/
|
|
818
1199
|
export function resetAll(achievementsToo: boolean): boolean
|
|
819
1200
|
/** @returns the float stat value, or `null` when the stat is not defined */
|
|
820
1201
|
export function getFloat(name: string): number | null
|
|
@@ -851,8 +1232,20 @@ export declare namespace timeline {
|
|
|
851
1232
|
export function addEvent(icon: string, title: string, description: string, priority: number, startOffsetSeconds: number, durationSeconds: number, clipPriority: TimelineEventClipPriority): void
|
|
852
1233
|
}
|
|
853
1234
|
export declare namespace utils {
|
|
1235
|
+
/**
|
|
1236
|
+
* Returns the AppID of the running game.
|
|
1237
|
+
* @returns the AppID
|
|
1238
|
+
*/
|
|
854
1239
|
export function getAppId(): number
|
|
1240
|
+
/**
|
|
1241
|
+
* Returns the current time on the Steam servers.
|
|
1242
|
+
* @returns seconds since 1970-01-01 UTC
|
|
1243
|
+
*/
|
|
855
1244
|
export function getServerRealTime(): number
|
|
1245
|
+
/**
|
|
1246
|
+
* Checks whether Steam is running on a Steam Deck.
|
|
1247
|
+
* @returns `true` on a Steam Deck, otherwise `false`
|
|
1248
|
+
*/
|
|
856
1249
|
export function isSteamRunningOnSteamDeck(): boolean
|
|
857
1250
|
export const enum GamepadTextInputMode {
|
|
858
1251
|
Normal = 0,
|
|
@@ -881,7 +1274,9 @@ export declare namespace utils {
|
|
|
881
1274
|
}
|
|
882
1275
|
export declare namespace workshop {
|
|
883
1276
|
export interface UgcResult {
|
|
1277
|
+
/** The Workshop item id the update or creation applies to. */
|
|
884
1278
|
itemId: bigint
|
|
1279
|
+
/** True when Steam reports that the account still has to accept the Workshop legal agreement. */
|
|
885
1280
|
needsToAcceptAgreement: boolean
|
|
886
1281
|
}
|
|
887
1282
|
export const enum UgcItemVisibility {
|
|
@@ -890,19 +1285,81 @@ export declare namespace workshop {
|
|
|
890
1285
|
Private = 2,
|
|
891
1286
|
Unlisted = 3
|
|
892
1287
|
}
|
|
1288
|
+
/** Workshop file types for `createItem`. Omitting the argument keeps `Community`. */
|
|
1289
|
+
export const enum WorkshopFileType {
|
|
1290
|
+
Community = 0,
|
|
1291
|
+
Art = 1,
|
|
1292
|
+
Screenshot = 2,
|
|
1293
|
+
Video = 3,
|
|
1294
|
+
Collection = 4,
|
|
1295
|
+
WebGuide = 5,
|
|
1296
|
+
IntegratedGuide = 6
|
|
1297
|
+
}
|
|
1298
|
+
/** Steam's community content descriptors. The values are the SDK's own IDs. */
|
|
1299
|
+
export const enum WorkshopContentDescriptor {
|
|
1300
|
+
NudityOrSexualContent = 1,
|
|
1301
|
+
FrequentViolenceOrGore = 2,
|
|
1302
|
+
AdultOnlySexualContent = 3,
|
|
1303
|
+
GratuitousSexualContent = 4,
|
|
1304
|
+
AnyMatureContent = 5
|
|
1305
|
+
}
|
|
1306
|
+
/** One key-value tag, stored on the item as `key=value`. */
|
|
1307
|
+
export interface KeyValueTag {
|
|
1308
|
+
key: string
|
|
1309
|
+
value: string
|
|
1310
|
+
}
|
|
1311
|
+
/** Key-value tag changes. They are applied in the order clear, remove, add. */
|
|
1312
|
+
export interface KeyValueTagsUpdate {
|
|
1313
|
+
/** Removes every key-value tag of the item first. */
|
|
1314
|
+
clear?: boolean
|
|
1315
|
+
/** Keys whose values are all removed. */
|
|
1316
|
+
remove?: Array<string>
|
|
1317
|
+
/** Pairs added after the removals. */
|
|
1318
|
+
add?: Array<KeyValueTag>
|
|
1319
|
+
}
|
|
1320
|
+
/** Content descriptor changes. Removals are applied before additions. */
|
|
1321
|
+
export interface ContentDescriptorsUpdate {
|
|
1322
|
+
remove?: Array<WorkshopContentDescriptor>
|
|
1323
|
+
add?: Array<WorkshopContentDescriptor>
|
|
1324
|
+
}
|
|
893
1325
|
export interface UgcUpdate {
|
|
1326
|
+
/** New title of the item, in the language given by `language`. */
|
|
894
1327
|
title?: string
|
|
1328
|
+
/** New description of the item, in the language given by `language`. */
|
|
895
1329
|
description?: string
|
|
1330
|
+
/** Note shown in the item's change history for this update. */
|
|
896
1331
|
changeNote?: string
|
|
1332
|
+
/** Absolute path of an image file that replaces the main preview. */
|
|
897
1333
|
previewPath?: string
|
|
898
1334
|
/** Image files appended to the item's additional previews (screenshots). */
|
|
899
1335
|
additionalPreviewPaths?: Array<string>
|
|
900
1336
|
/** 0-based indexes of additional previews to remove, as listed in `additionalPreviews`. */
|
|
901
1337
|
removeAdditionalPreviewIndexes?: Array<number>
|
|
1338
|
+
/** Absolute path of a folder whose files become the item's content. */
|
|
902
1339
|
contentPath?: string
|
|
1340
|
+
/** Tags for the item. When given, they replace the item's tag list. */
|
|
903
1341
|
tags?: Array<string>
|
|
1342
|
+
/** Who can see the item: Public, FriendsOnly, Private or Unlisted. */
|
|
904
1343
|
visibility?: UgcItemVisibility
|
|
1344
|
+
/** Steam language code (for example `english` or `schinese`) that `title` and `description` are written in. Left out, the README says it is treated as `english`. */
|
|
905
1345
|
language?: string
|
|
1346
|
+
/**
|
|
1347
|
+
* Oldest game version (Steam branch, e.g. `open_beta`) the item is valid for.
|
|
1348
|
+
* Set either required-version field to change the range; the unset end becomes open.
|
|
1349
|
+
* Pass both as `""` to make the item valid for every game version again.
|
|
1350
|
+
* Steam applies the range only when this update also changes the item's content.
|
|
1351
|
+
*/
|
|
1352
|
+
requiredGameVersionMin?: string
|
|
1353
|
+
/** Newest game version (Steam branch) the item is valid for; see `requiredGameVersionMin`. */
|
|
1354
|
+
requiredGameVersionMax?: string
|
|
1355
|
+
/** YouTube video IDs (11 characters each) added as video previews. Checked before submission. */
|
|
1356
|
+
additionalPreviewVideos?: Array<string>
|
|
1357
|
+
/** Developer metadata set on the item. Left unchanged when omitted. */
|
|
1358
|
+
metadata?: string
|
|
1359
|
+
/** Key-value tag changes, applied in the order clear, remove, add. */
|
|
1360
|
+
keyValueTags?: KeyValueTagsUpdate
|
|
1361
|
+
/** Content descriptor changes, applied as removals then additions. */
|
|
1362
|
+
contentDescriptors?: ContentDescriptorsUpdate
|
|
906
1363
|
}
|
|
907
1364
|
export interface InstallInfo {
|
|
908
1365
|
folder: string
|
|
@@ -926,7 +1383,31 @@ export declare namespace workshop {
|
|
|
926
1383
|
progress: bigint
|
|
927
1384
|
total: bigint
|
|
928
1385
|
}
|
|
929
|
-
|
|
1386
|
+
/**
|
|
1387
|
+
* Creates an empty Workshop item. The file type defaults to `Community`; `Art` creates an Artwork item.
|
|
1388
|
+
*
|
|
1389
|
+
* @param appId - defaults to the app id the client was initialized with
|
|
1390
|
+
* @param fileType - the Workshop file type; omitted keeps `Community`
|
|
1391
|
+
*/
|
|
1392
|
+
export function createItem(appId?: number | undefined | null, fileType?: WorkshopFileType | undefined | null): Promise<UgcResult>
|
|
1393
|
+
/**
|
|
1394
|
+
* Updates an existing Workshop item on Steam. Every field of `updateDetails` is optional: a field
|
|
1395
|
+
* that is left out keeps the item's current value, so a call with only `previewPath` changes only
|
|
1396
|
+
* the preview. The fields are checked first, and a bad YouTube video id or a string with a NUL byte
|
|
1397
|
+
* rejects with the entry named, before anything is sent.
|
|
1398
|
+
*
|
|
1399
|
+
* Once submitted, the change is applied to the item on Steam and cannot be cancelled. A running,
|
|
1400
|
+
* logged-in Steam client is needed.
|
|
1401
|
+
*
|
|
1402
|
+
* Resolves with the item id and `needsToAcceptAgreement`. Rejects when the update cannot be started,
|
|
1403
|
+
* when Steam returns an error, or when no completion arrives; in that last case the outcome is
|
|
1404
|
+
* unknown, so read the item before retrying.
|
|
1405
|
+
*
|
|
1406
|
+
* @param itemId - the Workshop item to update (its published file id)
|
|
1407
|
+
* @param updateDetails - the fields to change; see `UgcUpdate`
|
|
1408
|
+
* @param appId - defaults to the app id the client was initialized with
|
|
1409
|
+
* @returns the item id and whether the account still has to accept the Workshop legal agreement
|
|
1410
|
+
*/
|
|
930
1411
|
export function updateItem(itemId: bigint, updateDetails: UgcUpdate, appId?: number | undefined | null): Promise<UgcResult>
|
|
931
1412
|
/**
|
|
932
1413
|
* Replace only the main preview image of a Workshop item.
|
|
@@ -952,6 +1433,29 @@ export declare namespace workshop {
|
|
|
952
1433
|
* @param changeNote - optional change note shown in the item's change history
|
|
953
1434
|
*/
|
|
954
1435
|
export function updateItemContent(itemId: bigint, contentPath: string, appId?: number | undefined | null, changeNote?: string | undefined | null): Promise<UgcResult>
|
|
1436
|
+
/**
|
|
1437
|
+
* Updates an existing Workshop item on Steam, like `updateItem`, but reports the outcome through
|
|
1438
|
+
* callbacks instead of a promise. The call returns at once; the work continues in the background.
|
|
1439
|
+
* Its fields are checked the same way as in `updateItem`.
|
|
1440
|
+
*
|
|
1441
|
+
* `successCallback` receives the `UgcResult`. `errorCallback` receives every failure, both the
|
|
1442
|
+
* check that runs before anything is sent and the errors Steam reports later. Nothing is thrown.
|
|
1443
|
+
*
|
|
1444
|
+
* `progressCallback` receives an `UpdateProgress` right away and then every
|
|
1445
|
+
* `progressCallbackIntervalMs`, until the status is `Invalid` or `CommittingChanges`. The units of
|
|
1446
|
+
* `progress` and `total` are unverified against a live Steam client.
|
|
1447
|
+
*
|
|
1448
|
+
* Once submitted, the change is applied to the item on Steam and cannot be cancelled. A running,
|
|
1449
|
+
* logged-in Steam client is needed.
|
|
1450
|
+
*
|
|
1451
|
+
* @param itemId - the Workshop item to update (its published file id)
|
|
1452
|
+
* @param updateDetails - the fields to change; see `UgcUpdate`
|
|
1453
|
+
* @param appId - defaults to the app id the client was initialized with
|
|
1454
|
+
* @param successCallback - called with the `UgcResult` when Steam completes the update
|
|
1455
|
+
* @param errorCallback - called with an `Error` when the update is refused or fails
|
|
1456
|
+
* @param progressCallback - optional; called with the `UpdateProgress` while the update runs
|
|
1457
|
+
* @param progressCallbackIntervalMs - milliseconds between progress reports; defaults to 1000
|
|
1458
|
+
*/
|
|
955
1459
|
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
1460
|
/**
|
|
957
1461
|
* Subscribe to a workshop item. It will be downloaded and installed as soon as possible.
|
|
@@ -1005,6 +1509,19 @@ export declare namespace workshop {
|
|
|
1005
1509
|
* @returns an array of subscribed workshop item ids
|
|
1006
1510
|
*/
|
|
1007
1511
|
export function getSubscribedItems(): Array<bigint>
|
|
1512
|
+
/**
|
|
1513
|
+
* Permanently deletes a Workshop item on Steam. The item is removed from the Workshop; the deletion
|
|
1514
|
+
* cannot be cancelled once it has been sent. A running, logged-in Steam client is needed.
|
|
1515
|
+
*
|
|
1516
|
+
* The code does not check ownership first; Steam decides whether the account may delete the item.
|
|
1517
|
+
*
|
|
1518
|
+
* Resolves with no value once Steam confirms the deletion. Rejects when Steam returns an error, or
|
|
1519
|
+
* when no completion arrives; in that last case the outcome is unknown, so read the item before
|
|
1520
|
+
* retrying.
|
|
1521
|
+
*
|
|
1522
|
+
* @param itemId - the Workshop item to delete (its published file id)
|
|
1523
|
+
* @returns resolves with no value once Steam confirms the deletion
|
|
1524
|
+
*/
|
|
1008
1525
|
export function deleteItem(itemId: bigint): Promise<void>
|
|
1009
1526
|
/**
|
|
1010
1527
|
* Marks `childId` as a required item of `parentId`. Resolves with the Steam result code, where `1` is
|
|
@@ -1017,6 +1534,89 @@ export declare namespace workshop {
|
|
|
1017
1534
|
* code (`1` is OK), with the same validation and rejection rules as `addDependency`.
|
|
1018
1535
|
*/
|
|
1019
1536
|
export function removeDependency(parentId: bigint, childId: bigint): Promise<number>
|
|
1537
|
+
/** The user's vote on a Workshop item, as Steam reports it. */
|
|
1538
|
+
export interface UserItemVoteState {
|
|
1539
|
+
votedUp: boolean
|
|
1540
|
+
votedDown: boolean
|
|
1541
|
+
/** The user has neither voted up nor down. */
|
|
1542
|
+
skipped: boolean
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* The app dependencies of a Workshop item. When `appIds` is shorter than
|
|
1546
|
+
* `totalAppDependencies`, the list is incomplete.
|
|
1547
|
+
*/
|
|
1548
|
+
export interface AppDependencies {
|
|
1549
|
+
/** Steam result code; `1` is OK. */
|
|
1550
|
+
result: number
|
|
1551
|
+
appIds: Array<number>
|
|
1552
|
+
totalAppDependencies: number
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Votes for (`voteUp` true) or against a Workshop item as the current user.
|
|
1556
|
+
*
|
|
1557
|
+
* **Changes the user's vote on Steam.** Resolves when Steam confirms the vote.
|
|
1558
|
+
*
|
|
1559
|
+
* @param itemId - the Workshop item
|
|
1560
|
+
* @param voteUp - true to vote up, false to vote down
|
|
1561
|
+
*/
|
|
1562
|
+
export function setUserItemVote(itemId: bigint, voteUp: boolean): Promise<void>
|
|
1563
|
+
/** Reads the current user's vote on a Workshop item. Read-only. */
|
|
1564
|
+
export function getUserItemVote(itemId: bigint): Promise<UserItemVoteState>
|
|
1565
|
+
/**
|
|
1566
|
+
* Adds a Workshop item to the current user's favorites.
|
|
1567
|
+
*
|
|
1568
|
+
* **Changes the user's favorites on Steam.**
|
|
1569
|
+
*
|
|
1570
|
+
* @param itemId - the Workshop item
|
|
1571
|
+
* @param appId - defaults to the app id the client was initialized with
|
|
1572
|
+
*/
|
|
1573
|
+
export function addItemToFavorites(itemId: bigint, appId?: number | undefined | null): Promise<void>
|
|
1574
|
+
/**
|
|
1575
|
+
* Removes a Workshop item from the current user's favorites.
|
|
1576
|
+
*
|
|
1577
|
+
* **Changes the user's favorites on Steam.**
|
|
1578
|
+
*
|
|
1579
|
+
* @param itemId - the Workshop item
|
|
1580
|
+
* @param appId - defaults to the app id the client was initialized with
|
|
1581
|
+
*/
|
|
1582
|
+
export function removeItemFromFavorites(itemId: bigint, appId?: number | undefined | null): Promise<void>
|
|
1583
|
+
/**
|
|
1584
|
+
* Starts playtime tracking for Workshop items. The list must not be empty.
|
|
1585
|
+
*
|
|
1586
|
+
* **Changes the user's playtime records on Steam.**
|
|
1587
|
+
*
|
|
1588
|
+
* @param itemIds - the Workshop items
|
|
1589
|
+
*/
|
|
1590
|
+
export function startPlaytimeTracking(itemIds: Array<bigint>): Promise<void>
|
|
1591
|
+
/**
|
|
1592
|
+
* Stops playtime tracking for Workshop items. The list must not be empty.
|
|
1593
|
+
*
|
|
1594
|
+
* **Changes the user's playtime records on Steam.**
|
|
1595
|
+
*
|
|
1596
|
+
* @param itemIds - the Workshop items
|
|
1597
|
+
*/
|
|
1598
|
+
export function stopPlaytimeTracking(itemIds: Array<bigint>): Promise<void>
|
|
1599
|
+
/**
|
|
1600
|
+
* Adds `appId` as an app dependency of a Workshop item (for example a DLC the item needs).
|
|
1601
|
+
* Resolves with the Steam result code, where `1` is OK. A non-OK code resolves rather than rejects.
|
|
1602
|
+
*
|
|
1603
|
+
* **Changes the item's remote state.**
|
|
1604
|
+
*/
|
|
1605
|
+
export function addAppDependency(itemId: bigint, appId: number): Promise<number>
|
|
1606
|
+
/**
|
|
1607
|
+
* Removes `appId` from the app dependencies of a Workshop item. Resolves with the Steam result code
|
|
1608
|
+
* (`1` is OK), with the same rules as `addAppDependency`.
|
|
1609
|
+
*
|
|
1610
|
+
* **Changes the item's remote state.**
|
|
1611
|
+
*/
|
|
1612
|
+
export function removeAppDependency(itemId: bigint, appId: number): Promise<number>
|
|
1613
|
+
/**
|
|
1614
|
+
* Reads every app dependency of a Workshop item. Steam sends them in pages; they are collected
|
|
1615
|
+
* until the reported total is reached. Read-only.
|
|
1616
|
+
*
|
|
1617
|
+
* Not verified against a live Steam client: see the paging note in steamworks-rs.
|
|
1618
|
+
*/
|
|
1619
|
+
export function getAppDependencies(itemId: bigint): Promise<AppDependencies>
|
|
1020
1620
|
export const enum UGCQueryType {
|
|
1021
1621
|
RankedByVote = 0,
|
|
1022
1622
|
RankedByPublicationDate = 1,
|
|
@@ -1118,12 +1718,27 @@ export declare namespace workshop {
|
|
|
1118
1718
|
/** Type of preview (image, video, sketchfab model, etc.) */
|
|
1119
1719
|
previewType: ItemPreviewType
|
|
1120
1720
|
}
|
|
1721
|
+
/**
|
|
1722
|
+
* A game version (Steam branch) range a Workshop item is valid for.
|
|
1723
|
+
* `minBranch` / `maxBranch` are branch names such as `open_beta`. An open end is left out
|
|
1724
|
+
* (`undefined`): no `minBranch` starts at the earliest branch, no `maxBranch` runs through the newest.
|
|
1725
|
+
*/
|
|
1726
|
+
export interface SupportedGameVersion {
|
|
1727
|
+
minBranch?: string
|
|
1728
|
+
maxBranch?: string
|
|
1729
|
+
}
|
|
1121
1730
|
export interface WorkshopItem {
|
|
1731
|
+
/** The Workshop item's published file id. */
|
|
1122
1732
|
publishedFileId: bigint
|
|
1733
|
+
/** The app id that created the item. */
|
|
1123
1734
|
creatorAppId?: number
|
|
1735
|
+
/** The app id that uses the item. */
|
|
1124
1736
|
consumerAppId?: number
|
|
1737
|
+
/** The item's title. */
|
|
1125
1738
|
title: string
|
|
1739
|
+
/** The item's description. */
|
|
1126
1740
|
description: string
|
|
1741
|
+
/** The Steam account that owns the item. */
|
|
1127
1742
|
owner: PlayerSteamId
|
|
1128
1743
|
/** Time created in unix epoch seconds format */
|
|
1129
1744
|
timeCreated: number
|
|
@@ -1131,52 +1746,149 @@ export declare namespace workshop {
|
|
|
1131
1746
|
timeUpdated: number
|
|
1132
1747
|
/** 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
1748
|
timeAddedToUserList: number
|
|
1749
|
+
/** Who can see the item: Public, FriendsOnly, Private or Unlisted. */
|
|
1134
1750
|
visibility: UgcItemVisibility
|
|
1751
|
+
/** Whether Steam has banned the item. */
|
|
1135
1752
|
banned: boolean
|
|
1753
|
+
/** Whether Steam has accepted the item for use. */
|
|
1136
1754
|
acceptedForUse: boolean
|
|
1755
|
+
/** The item's tags. */
|
|
1137
1756
|
tags: Array<string>
|
|
1757
|
+
/** Whether Steam cut the tag list short. */
|
|
1138
1758
|
tagsTruncated: boolean
|
|
1139
1759
|
url: string
|
|
1760
|
+
/** Number of upvotes the item has. */
|
|
1140
1761
|
numUpvotes: number
|
|
1762
|
+
/** Number of downvotes the item has. */
|
|
1141
1763
|
numDownvotes: number
|
|
1764
|
+
/** Number of required items the item has. */
|
|
1142
1765
|
numChildren: number
|
|
1766
|
+
/** URL of the item's main preview image, when Steam returns one. */
|
|
1143
1767
|
previewUrl?: string
|
|
1768
|
+
/** Counts for the item, such as subscriptions and favorites. */
|
|
1144
1769
|
statistics: WorkshopItemStatistic
|
|
1770
|
+
/** Ids of the item's required items. Present only with `returnChildren`. */
|
|
1145
1771
|
children?: Array<bigint>
|
|
1146
1772
|
/** Additional preview media (images, videos, etc.) for the workshop item */
|
|
1147
1773
|
additionalPreviews?: Array<AdditionalPreview>
|
|
1774
|
+
/** Game versions (Steam branches) the item is valid for. Empty when Steam returns no range. */
|
|
1775
|
+
supportedGameVersions: Array<SupportedGameVersion>
|
|
1148
1776
|
}
|
|
1149
1777
|
export interface WorkshopPaginatedResult {
|
|
1778
|
+
/** The entries of this page; `null` where Steam returned no record. */
|
|
1150
1779
|
items: Array<WorkshopItem | undefined | null>
|
|
1780
|
+
/** The number of entries Steam returned on this page. */
|
|
1151
1781
|
returnedResults: number
|
|
1782
|
+
/** The number of matches across all pages. */
|
|
1152
1783
|
totalResults: number
|
|
1784
|
+
/** Whether the answer came from Steam's cache. */
|
|
1153
1785
|
wasCached: boolean
|
|
1154
1786
|
}
|
|
1155
1787
|
export interface WorkshopItemsResult {
|
|
1788
|
+
/** One entry per record Steam returned; `null` where Steam returned no record. */
|
|
1156
1789
|
items: Array<WorkshopItem | undefined | null>
|
|
1790
|
+
/** Whether the answer came from Steam's cache. */
|
|
1157
1791
|
wasCached: boolean
|
|
1158
1792
|
}
|
|
1159
1793
|
export interface WorkshopItemQueryConfig {
|
|
1794
|
+
/** Oldest cached answer Steam may return, in seconds. */
|
|
1160
1795
|
cachedResponseMaxAge?: number
|
|
1796
|
+
/** Return the item's developer metadata. */
|
|
1161
1797
|
includeMetadata?: boolean
|
|
1798
|
+
/** Return the long description of the item. */
|
|
1162
1799
|
includeLongDescription?: boolean
|
|
1800
|
+
/** Fill `additionalPreviews` on each returned item. */
|
|
1163
1801
|
includeAdditionalPreviews?: boolean
|
|
1802
|
+
/** Return only the item ids, not the item details. */
|
|
1164
1803
|
onlyIds?: boolean
|
|
1804
|
+
/** Return only the total number of matches. */
|
|
1165
1805
|
onlyTotal?: boolean
|
|
1806
|
+
/** Steam language code for the returned title and description, such as `schinese`. */
|
|
1166
1807
|
language?: string
|
|
1808
|
+
/** Match items that have any of the required tags, instead of all of them. */
|
|
1167
1809
|
matchAnyTag?: boolean
|
|
1810
|
+
/** Tags an item must have. */
|
|
1168
1811
|
requiredTags?: Array<string>
|
|
1812
|
+
/** Tags an item must not have. */
|
|
1169
1813
|
excludedTags?: Array<string>
|
|
1814
|
+
/** Full-text search string. */
|
|
1170
1815
|
searchText?: string
|
|
1816
|
+
/** Number of days considered when ranking items by trend. */
|
|
1171
1817
|
rankedByTrendDays?: number
|
|
1818
|
+
/** Fill `children` with the ids of each item's required items. */
|
|
1172
1819
|
returnChildren?: boolean
|
|
1173
1820
|
}
|
|
1174
1821
|
export interface AppIDs {
|
|
1175
1822
|
creator?: number
|
|
1176
1823
|
consumer?: number
|
|
1177
1824
|
}
|
|
1825
|
+
/**
|
|
1826
|
+
* Gets one Workshop item by its published file id. The query runs through the Steam client, so a
|
|
1827
|
+
* running Steam client is needed. Whether a logged-in account is also required is unverified
|
|
1828
|
+
* against a live Steam client.
|
|
1829
|
+
*
|
|
1830
|
+
* Resolves with the item, or with `null` when the query returns no record for the id. The optional
|
|
1831
|
+
* `children` field is filled only with `returnChildren`, and `additionalPreviews` only with
|
|
1832
|
+
* `includeAdditionalPreviews`. Rejects when the query cannot be created or Steam returns an error.
|
|
1833
|
+
*
|
|
1834
|
+
* @param item - the Workshop item to read (its published file id)
|
|
1835
|
+
* @param queryConfig - optional query options; see `WorkshopItemQueryConfig`. Omitted, no options are set.
|
|
1836
|
+
* @returns the item, or `null` when the query returned no record for the id
|
|
1837
|
+
*/
|
|
1178
1838
|
export function getItem(item: bigint, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopItem | null>
|
|
1839
|
+
/**
|
|
1840
|
+
* Gets several Workshop items in one query. The query runs through the Steam client, so a running
|
|
1841
|
+
* Steam client is needed. Whether a logged-in account is also required is unverified against a
|
|
1842
|
+
* live Steam client.
|
|
1843
|
+
*
|
|
1844
|
+
* Resolves with `items` and `wasCached`. `items` has one entry per record Steam returned, and an
|
|
1845
|
+
* entry is `null` where Steam returned no record. The entries are not matched back to the input
|
|
1846
|
+
* ids, so use each item's `publishedFileId` to match them. Rejects when the query cannot be created
|
|
1847
|
+
* or Steam returns an error.
|
|
1848
|
+
*
|
|
1849
|
+
* @param items - the published file ids to read
|
|
1850
|
+
* @param queryConfig - optional query options; see `WorkshopItemQueryConfig`. Omitted, no options are set.
|
|
1851
|
+
* @returns `items`, and `wasCached` for whether the answer came from Steam's cache
|
|
1852
|
+
*/
|
|
1179
1853
|
export function getItems(items: Array<bigint>, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopItemsResult>
|
|
1854
|
+
/**
|
|
1855
|
+
* Queries one page of all Workshop items that match the given type, ranking and app ids. The query
|
|
1856
|
+
* runs through the Steam client, so a running Steam client is needed. Whether a logged-in account
|
|
1857
|
+
* is also required is unverified against a live Steam client.
|
|
1858
|
+
*
|
|
1859
|
+
* Resolves with `items` for this page, `returnedResults` (the number of entries on this page),
|
|
1860
|
+
* `totalResults` (the matches across all pages) and `wasCached`. Entries are `null` where Steam
|
|
1861
|
+
* returned no record. To read everything, keep requesting pages while the collected count is below
|
|
1862
|
+
* `totalResults` and the last page returned items. The page size is set by Steam; the README and
|
|
1863
|
+
* the skill give 50 per page, unverified against a live Steam client. Rejects when the query cannot
|
|
1864
|
+
* be created or Steam returns an error.
|
|
1865
|
+
*
|
|
1866
|
+
* @param page - the page to read, passed to Steam as given; the first page index is unverified against a live Steam client
|
|
1867
|
+
* @param queryType - the ranking and filter of the query, a `UGCQueryType` value such as `RankedByPublicationDate`
|
|
1868
|
+
* @param itemType - the kind of item to list, a `UGCType` value such as `Items`
|
|
1869
|
+
* @param creatorAppId - the app id that created the items
|
|
1870
|
+
* @param consumerAppId - the app id that uses the items; Steam filters by both app ids
|
|
1871
|
+
* @param queryConfig - optional query options; see `WorkshopItemQueryConfig`. Omitted, no options are set.
|
|
1872
|
+
* @returns the page of items with `returnedResults`, `totalResults` and `wasCached`
|
|
1873
|
+
*/
|
|
1180
1874
|
export function getAllItems(page: number, queryType: UGCQueryType, itemType: UGCType, creatorAppId: number, consumerAppId: number, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopPaginatedResult>
|
|
1875
|
+
/**
|
|
1876
|
+
* Queries one page of the Workshop items related to one user, such as their published, subscribed or
|
|
1877
|
+
* favorited items. The query runs through the Steam client, so a running Steam client is needed.
|
|
1878
|
+
* Whether a logged-in account is also required is unverified against a live Steam client.
|
|
1879
|
+
*
|
|
1880
|
+
* Resolves with the same fields as `getAllItems`: `items` for this page, `returnedResults`,
|
|
1881
|
+
* `totalResults` and `wasCached`. Entries are `null` where Steam returned no record. Paging works as
|
|
1882
|
+
* described for `getAllItems`. Rejects when the query cannot be created or Steam returns an error.
|
|
1883
|
+
*
|
|
1884
|
+
* @param page - the page to read, passed to Steam as given; the first page index is unverified against a live Steam client
|
|
1885
|
+
* @param accountId - the 32-bit account id of the user (the lower 32 bits of their SteamID64)
|
|
1886
|
+
* @param listType - which list to read, a `UserListType` value such as `Published` or `Subscribed`
|
|
1887
|
+
* @param itemType - the kind of item to list, a `UGCType` value such as `Items`
|
|
1888
|
+
* @param sortOrder - the order of the list, a `UserListOrder` value such as `LastUpdatedDesc`
|
|
1889
|
+
* @param appIds - the `creator` and `consumer` app ids; a missing one is sent as `0`, and what Steam does with `0` is unverified
|
|
1890
|
+
* @param queryConfig - optional query options; see `WorkshopItemQueryConfig`. Omitted, no options are set.
|
|
1891
|
+
* @returns the page of items with `returnedResults`, `totalResults` and `wasCached`
|
|
1892
|
+
*/
|
|
1181
1893
|
export function getUserItems(page: number, accountId: number, listType: UserListType, itemType: UGCType, sortOrder: UserListOrder, appIds: AppIDs, queryConfig?: WorkshopItemQueryConfig | undefined | null): Promise<WorkshopPaginatedResult>
|
|
1182
1894
|
}
|