Skip to content

Updated typings from obs-websocket 5.0.2 #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions scripts/build-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ const headers = {
Authorization: process.env.GH_TOKEN ? `token ${process.env.GH_TOKEN}` : undefined,
};

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

const {body: protocol} = await got<GeneratedProtocol>(`https://raw.githubusercontent.com/obsproject/obs-websocket/${commit}/docs/generated/protocol.json`, {
headers,
Expand Down
154 changes: 152 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export enum EventSubscription {
*
* Initial OBS Version: 5.0.0
*/
All = (General | Config | Scenes | Inputs | Transitions | Filters | Outputs | SceneItems | MediaInputs | Vendors),
All = (General | Config | Scenes | Inputs | Transitions | Filters | Outputs | SceneItems | MediaInputs | Vendors | Ui),
/**
* Subscription value to receive the `InputVolumeMeters` high-volume event.
*
Expand Down Expand Up @@ -629,6 +629,10 @@ export interface OBSEventTypes {
* The specific state of the output
*/
outputState: string;
/**
* File name for the saved recording, if record stopped. `null` otherwise
*/
outputPath: string;
};
ReplayBufferStateChanged: {
/**
Expand Down Expand Up @@ -1460,6 +1464,47 @@ export interface OBSRequestTypes {
StopReplayBuffer: never;
SaveReplayBuffer: never;
GetLastReplayBufferReplay: never;
GetOutputList: never;
GetOutputStatus: {
/**
* Output name
*/
outputName: string;
};
ToggleOutput: {
/**
* Output name
*/
outputName: string;
};
StartOutput: {
/**
* Output name
*/
outputName: string;
};
StopOutput: {
/**
* Output name
*/
outputName: string;
};
GetOutputSettings: {
/**
* Output name
*/
outputName: string;
};
SetOutputSettings: {
/**
* Output name
*/
outputName: string;
/**
* Output settings
*/
outputSettings: JsonObject;
};
GetRecordStatus: never;
ToggleRecord: never;
StartRecord: never;
Expand Down Expand Up @@ -1900,6 +1945,42 @@ export interface OBSRequestTypes {
inputName: string;
};
GetMonitorList: never;
OpenVideoMixProjector: {
/**
* Type of mix to open
*/
videoMixType: string;
/**
* Monitor index, use `GetMonitorList` to obtain index
*
* @defaultValue -1: Opens projector in windowed mode
*/
monitorIndex?: number;
/**
* Size/Position data for a windowed projector, in Qt Base64 encoded format. Mutually exclusive with `monitorIndex`
*
* @defaultValue N/A
*/
projectorGeometry?: string;
};
OpenSourceProjector: {
/**
* Name of the source to open a projector for
*/
sourceName: string;
/**
* Monitor index, use `GetMonitorList` to obtain index
*
* @defaultValue -1: Opens projector in windowed mode
*/
monitorIndex?: number;
/**
* Size/Position data for a windowed projector, in Qt Base64 encoded format. Mutually exclusive with `monitorIndex`
*
* @defaultValue N/A
*/
projectorGeometry?: string;
};
}

export interface OBSResponseTypes {
Expand Down Expand Up @@ -2104,6 +2185,14 @@ export interface OBSResponseTypes {
};
BroadcastCustomEvent: undefined;
CallVendorRequest: {
/**
* Echoed of `vendorName`
*/
vendorName: string;
/**
* Echoed of `requestType`
*/
requestType: string;
/**
* Object containing appropriate response data. {} if request does not provide any response data
*/
Expand Down Expand Up @@ -2292,6 +2381,56 @@ export interface OBSResponseTypes {
*/
savedReplayPath: string;
};
GetOutputList: undefined;
GetOutputStatus: {
/**
* Whether the output is active
*/
outputActive: boolean;
/**
* Whether the output is reconnecting
*/
outputReconnecting: boolean;
/**
* Current formatted timecode string for the output
*/
outputTimecode: string;
/**
* Current duration in milliseconds for the output
*/
outputDuration: number;
/**
* Congestion of the output
*/
outputCongestion: number;
/**
* Number of bytes sent by the output
*/
outputBytes: number;
/**
* Number of frames skipped by the output's process
*/
outputSkippedFrames: number;
/**
* Total number of frames delivered by the output's process
*/
outputTotalFrames: number;
};
ToggleOutput: {
/**
* Whether the output is active
*/
outputActive: boolean;
};
StartOutput: undefined;
StopOutput: undefined;
GetOutputSettings: {
/**
* Output settings
*/
outputSettings: JsonObject;
};
SetOutputSettings: undefined;
GetRecordStatus: {
/**
* Whether the output is active
Expand All @@ -2316,7 +2455,12 @@ export interface OBSResponseTypes {
};
ToggleRecord: undefined;
StartRecord: undefined;
StopRecord: undefined;
StopRecord: {
/**
* File name for the saved recording
*/
outputPath: string;
};
ToggleRecordPause: undefined;
PauseRecord: undefined;
ResumeRecord: undefined;
Expand Down Expand Up @@ -2473,6 +2617,10 @@ export interface OBSResponseTypes {
* Current duration in milliseconds for the output
*/
outputDuration: number;
/**
* Congestion of the output
*/
outputCongestion: number;
/**
* Number of bytes sent by the output
*/
Expand Down Expand Up @@ -2568,4 +2716,6 @@ export interface OBSResponseTypes {
*/
monitors: JsonObject[];
};
OpenVideoMixProjector: undefined;
OpenSourceProjector: undefined;
}