Skip to content

Commit 1b1b26b

Browse files
dangmait2t2
andauthored
Updated typings from obs-websocket 5.0.2 (#308)
* Build types from custom commit * Updates types from obs-websocket 5.0.2 * Allow also passing the commit via args example: `npm run generate:obs-types master` = `GH_COMMIT=master npm run generate:obs-types` Co-authored-by: t2t2 <[email protected]>
1 parent 4972811 commit 1b1b26b

File tree

2 files changed

+160
-7
lines changed

2 files changed

+160
-7
lines changed

scripts/build-types.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,14 @@ const headers = {
7777
Authorization: process.env.GH_TOKEN ? `token ${process.env.GH_TOKEN}` : undefined,
7878
};
7979

80-
const {body: release} = await got('https://api.github.com/repos/obsproject/obs-websocket/releases/latest', {
81-
headers,
82-
responseType: 'json',
83-
});
84-
const commit = (release as JsonObject).tag_name as string;
80+
let commit = process.argv[2] ?? process.env.GH_COMMIT;
81+
if (!commit) {
82+
const {body: release} = await got('https://api.github.com/repos/obsproject/obs-websocket/releases/latest', {
83+
headers,
84+
responseType: 'json',
85+
});
86+
commit = (release as JsonObject).tag_name as string;
87+
}
8588

8689
const {body: protocol} = await got<GeneratedProtocol>(`https://raw.githubusercontent.com/obsproject/obs-websocket/${commit}/docs/generated/protocol.json`, {
8790
headers,

src/types.ts

Lines changed: 152 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export enum EventSubscription {
140140
*
141141
* Initial OBS Version: 5.0.0
142142
*/
143-
All = (General | Config | Scenes | Inputs | Transitions | Filters | Outputs | SceneItems | MediaInputs | Vendors),
143+
All = (General | Config | Scenes | Inputs | Transitions | Filters | Outputs | SceneItems | MediaInputs | Vendors | Ui),
144144
/**
145145
* Subscription value to receive the `InputVolumeMeters` high-volume event.
146146
*
@@ -629,6 +629,10 @@ export interface OBSEventTypes {
629629
* The specific state of the output
630630
*/
631631
outputState: string;
632+
/**
633+
* File name for the saved recording, if record stopped. `null` otherwise
634+
*/
635+
outputPath: string;
632636
};
633637
ReplayBufferStateChanged: {
634638
/**
@@ -1460,6 +1464,47 @@ export interface OBSRequestTypes {
14601464
StopReplayBuffer: never;
14611465
SaveReplayBuffer: never;
14621466
GetLastReplayBufferReplay: never;
1467+
GetOutputList: never;
1468+
GetOutputStatus: {
1469+
/**
1470+
* Output name
1471+
*/
1472+
outputName: string;
1473+
};
1474+
ToggleOutput: {
1475+
/**
1476+
* Output name
1477+
*/
1478+
outputName: string;
1479+
};
1480+
StartOutput: {
1481+
/**
1482+
* Output name
1483+
*/
1484+
outputName: string;
1485+
};
1486+
StopOutput: {
1487+
/**
1488+
* Output name
1489+
*/
1490+
outputName: string;
1491+
};
1492+
GetOutputSettings: {
1493+
/**
1494+
* Output name
1495+
*/
1496+
outputName: string;
1497+
};
1498+
SetOutputSettings: {
1499+
/**
1500+
* Output name
1501+
*/
1502+
outputName: string;
1503+
/**
1504+
* Output settings
1505+
*/
1506+
outputSettings: JsonObject;
1507+
};
14631508
GetRecordStatus: never;
14641509
ToggleRecord: never;
14651510
StartRecord: never;
@@ -1900,6 +1945,42 @@ export interface OBSRequestTypes {
19001945
inputName: string;
19011946
};
19021947
GetMonitorList: never;
1948+
OpenVideoMixProjector: {
1949+
/**
1950+
* Type of mix to open
1951+
*/
1952+
videoMixType: string;
1953+
/**
1954+
* Monitor index, use `GetMonitorList` to obtain index
1955+
*
1956+
* @defaultValue -1: Opens projector in windowed mode
1957+
*/
1958+
monitorIndex?: number;
1959+
/**
1960+
* Size/Position data for a windowed projector, in Qt Base64 encoded format. Mutually exclusive with `monitorIndex`
1961+
*
1962+
* @defaultValue N/A
1963+
*/
1964+
projectorGeometry?: string;
1965+
};
1966+
OpenSourceProjector: {
1967+
/**
1968+
* Name of the source to open a projector for
1969+
*/
1970+
sourceName: string;
1971+
/**
1972+
* Monitor index, use `GetMonitorList` to obtain index
1973+
*
1974+
* @defaultValue -1: Opens projector in windowed mode
1975+
*/
1976+
monitorIndex?: number;
1977+
/**
1978+
* Size/Position data for a windowed projector, in Qt Base64 encoded format. Mutually exclusive with `monitorIndex`
1979+
*
1980+
* @defaultValue N/A
1981+
*/
1982+
projectorGeometry?: string;
1983+
};
19031984
}
19041985

19051986
export interface OBSResponseTypes {
@@ -2104,6 +2185,14 @@ export interface OBSResponseTypes {
21042185
};
21052186
BroadcastCustomEvent: undefined;
21062187
CallVendorRequest: {
2188+
/**
2189+
* Echoed of `vendorName`
2190+
*/
2191+
vendorName: string;
2192+
/**
2193+
* Echoed of `requestType`
2194+
*/
2195+
requestType: string;
21072196
/**
21082197
* Object containing appropriate response data. {} if request does not provide any response data
21092198
*/
@@ -2292,6 +2381,56 @@ export interface OBSResponseTypes {
22922381
*/
22932382
savedReplayPath: string;
22942383
};
2384+
GetOutputList: undefined;
2385+
GetOutputStatus: {
2386+
/**
2387+
* Whether the output is active
2388+
*/
2389+
outputActive: boolean;
2390+
/**
2391+
* Whether the output is reconnecting
2392+
*/
2393+
outputReconnecting: boolean;
2394+
/**
2395+
* Current formatted timecode string for the output
2396+
*/
2397+
outputTimecode: string;
2398+
/**
2399+
* Current duration in milliseconds for the output
2400+
*/
2401+
outputDuration: number;
2402+
/**
2403+
* Congestion of the output
2404+
*/
2405+
outputCongestion: number;
2406+
/**
2407+
* Number of bytes sent by the output
2408+
*/
2409+
outputBytes: number;
2410+
/**
2411+
* Number of frames skipped by the output's process
2412+
*/
2413+
outputSkippedFrames: number;
2414+
/**
2415+
* Total number of frames delivered by the output's process
2416+
*/
2417+
outputTotalFrames: number;
2418+
};
2419+
ToggleOutput: {
2420+
/**
2421+
* Whether the output is active
2422+
*/
2423+
outputActive: boolean;
2424+
};
2425+
StartOutput: undefined;
2426+
StopOutput: undefined;
2427+
GetOutputSettings: {
2428+
/**
2429+
* Output settings
2430+
*/
2431+
outputSettings: JsonObject;
2432+
};
2433+
SetOutputSettings: undefined;
22952434
GetRecordStatus: {
22962435
/**
22972436
* Whether the output is active
@@ -2316,7 +2455,12 @@ export interface OBSResponseTypes {
23162455
};
23172456
ToggleRecord: undefined;
23182457
StartRecord: undefined;
2319-
StopRecord: undefined;
2458+
StopRecord: {
2459+
/**
2460+
* File name for the saved recording
2461+
*/
2462+
outputPath: string;
2463+
};
23202464
ToggleRecordPause: undefined;
23212465
PauseRecord: undefined;
23222466
ResumeRecord: undefined;
@@ -2473,6 +2617,10 @@ export interface OBSResponseTypes {
24732617
* Current duration in milliseconds for the output
24742618
*/
24752619
outputDuration: number;
2620+
/**
2621+
* Congestion of the output
2622+
*/
2623+
outputCongestion: number;
24762624
/**
24772625
* Number of bytes sent by the output
24782626
*/
@@ -2568,4 +2716,6 @@ export interface OBSResponseTypes {
25682716
*/
25692717
monitors: JsonObject[];
25702718
};
2719+
OpenVideoMixProjector: undefined;
2720+
OpenSourceProjector: undefined;
25712721
}

0 commit comments

Comments
 (0)