diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b9375a..9f11a41 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,10 +36,10 @@ jobs: with: fetch-depth: 0 # Required for MinVer to determine the version from Git history - - name: Setup .NET 9 SDK + - name: Setup .NET 10 SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: '9.x' # Use the specific .NET 9 SDK + dotnet-version: '10.x' - name: Restore dependencies run: dotnet restore ObsWebSocket.sln @@ -47,6 +47,26 @@ jobs: - name: Build Solution run: dotnet build ObsWebSocket.sln --configuration Release --no-restore + - name: Restore Example for AOT RID graph + run: > + dotnet restore ObsWebSocket.Example/ObsWebSocket.Example.csproj + -p:TargetFramework=net10.0 + --runtime linux-x64 + -p:SelfContained=true + -p:PublishAot=true + + - name: Native AOT Smoke Publish (ObsWebSocket.Example) + run: > + dotnet publish ObsWebSocket.Example/ObsWebSocket.Example.csproj + --configuration Release + --framework net10.0 + --runtime linux-x64 + --self-contained true + /p:PublishAot=true + /p:ILLinkTreatWarningsAsErrors=true + /p:IlcTreatWarningsAsErrors=true + /p:WarningsNotAsErrors=IL2104%3BIL3053 + - name: Run Unit Tests # Run tests specifically for the ObsWebSocket.Tests project # Exclude integration tests which require a live OBS instance diff --git a/ObsWebSocket.Codegen.Tasks/GenerateObsWebSocketSourcesTask.cs b/ObsWebSocket.Codegen.Tasks/GenerateObsWebSocketSourcesTask.cs new file mode 100644 index 0000000..64861e1 --- /dev/null +++ b/ObsWebSocket.Codegen.Tasks/GenerateObsWebSocketSourcesTask.cs @@ -0,0 +1,31 @@ +using Microsoft.Build.Framework; + +namespace ObsWebSocket.Codegen.Tasks; + +public sealed class GenerateObsWebSocketSourcesTask : Microsoft.Build.Utilities.Task +{ + [Required] + public string ProtocolPath { get; set; } = string.Empty; + + [Required] + public string OutputDirectory { get; set; } = string.Empty; + + public bool DownloadIfMissing { get; set; } + + public override bool Execute() + { + int exitCode = ProtocolCodegenRunner.GenerateAsync( + protocolPath: ProtocolPath, + outputDirectory: OutputDirectory, + downloadIfMissing: DownloadIfMissing, + cancellationToken: CancellationToken.None, + logInfo: message => Log.LogMessage(MessageImportance.High, message), + logWarning: message => Log.LogWarning(message), + logError: message => Log.LogError(message) + ) + .GetAwaiter() + .GetResult(); + + return exitCode == 0 && !Log.HasLoggedErrors; + } +} diff --git a/ObsWebSocket.SourceGenerators/Diagnostics.cs b/ObsWebSocket.Codegen.Tasks/Generation/Diagnostics.cs similarity index 95% rename from ObsWebSocket.SourceGenerators/Diagnostics.cs rename to ObsWebSocket.Codegen.Tasks/Generation/Diagnostics.cs index b06af61..cfc6549 100644 --- a/ObsWebSocket.SourceGenerators/Diagnostics.cs +++ b/ObsWebSocket.Codegen.Tasks/Generation/Diagnostics.cs @@ -1,16 +1,10 @@ -using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis; -namespace ObsWebSocket.SourceGenerators; +namespace ObsWebSocket.Codegen.Tasks.Generation; /// /// Contains DiagnosticDescriptor constants for reporting errors and warnings during source generation. /// -[SuppressMessage( - "StyleCop.CSharp.OrderingRules", - "SA1202:Elements must be ordered by access", - Justification = "Constants grouped logically." -)] internal static class Diagnostics { private const string Category = "ObsWebSocketGenerator"; diff --git a/ObsWebSocket.SourceGenerators/Emitter.DtoGeneration.cs b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.DtoGeneration.cs similarity index 99% rename from ObsWebSocket.SourceGenerators/Emitter.DtoGeneration.cs rename to ObsWebSocket.Codegen.Tasks/Generation/Emitter.DtoGeneration.cs index e02aa31..6b9d948 100644 --- a/ObsWebSocket.SourceGenerators/Emitter.DtoGeneration.cs +++ b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.DtoGeneration.cs @@ -1,9 +1,9 @@ -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Text; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Text; -namespace ObsWebSocket.SourceGenerators; +namespace ObsWebSocket.Codegen.Tasks.Generation; /// /// Contains logic for generating Data Transfer Object (DTO) records, including handling nested records. @@ -374,6 +374,7 @@ ProtocolDefinition protocol mainBuilder.AppendLine("using System.Text.Json;"); mainBuilder.AppendLine("using System.Text.Json.Serialization;"); mainBuilder.AppendLine("using System.Diagnostics.CodeAnalysis;"); + mainBuilder.AppendLine("using MessagePack;"); mainBuilder.AppendLine($"using {GeneratedCommonNamespace};"); if (!isNestedType) { @@ -445,6 +446,7 @@ ProtocolDefinition protocol mainBuilder.AppendLine("#pragma warning disable CS8618"); // --- Record Definition Start --- + mainBuilder.AppendLine("[MessagePackObject]"); mainBuilder.AppendLine($"public sealed partial record {recordName}"); mainBuilder.AppendLine("{"); List propertyInfos = []; @@ -545,6 +547,7 @@ ProtocolDefinition protocol } mainBuilder.AppendLine($" [JsonPropertyName(\"{originalName}\")]"); + mainBuilder.AppendLine($" [Key(\"{originalName}\")]"); mainBuilder.Append(" public "); if (isConsideredRequired) { diff --git a/ObsWebSocket.SourceGenerators/Emitter.Helpers.cs b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.Helpers.cs similarity index 99% rename from ObsWebSocket.SourceGenerators/Emitter.Helpers.cs rename to ObsWebSocket.Codegen.Tasks/Generation/Emitter.Helpers.cs index 8475b64..d6f643b 100644 --- a/ObsWebSocket.SourceGenerators/Emitter.Helpers.cs +++ b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.Helpers.cs @@ -1,9 +1,9 @@ -using System.Text; +using System.Text; using System.Text.Json; using System.Text.RegularExpressions; using Microsoft.CodeAnalysis; -namespace ObsWebSocket.SourceGenerators; +namespace ObsWebSocket.Codegen.Tasks.Generation; /// /// Contains helper methods, constants, and internal data structures for the Emitter class. @@ -238,7 +238,7 @@ string parentDtoName // Map specifically named 'Object' field to Stub record // Use the fully qualified name to avoid potential namespace conflicts return ($"{GeneratedCommonNamespace}.SceneItemTransformStub?", false); - // Add other specific 'Object' mappings here if needed in the future + // Add other specific 'Object' mappings here if needed in the future } // If not handled above, it falls through to the general 'Object'/'Any' handling below } diff --git a/ObsWebSocket.SourceGenerators/Emitter.Hierarchy.cs b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.Hierarchy.cs similarity index 98% rename from ObsWebSocket.SourceGenerators/Emitter.Hierarchy.cs rename to ObsWebSocket.Codegen.Tasks/Generation/Emitter.Hierarchy.cs index 1717938..df97d58 100644 --- a/ObsWebSocket.SourceGenerators/Emitter.Hierarchy.cs +++ b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.Hierarchy.cs @@ -1,6 +1,6 @@ -using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis; -namespace ObsWebSocket.SourceGenerators; +namespace ObsWebSocket.Codegen.Tasks.Generation; /// /// Contains logic for building the object hierarchy from dot-notated field definitions. @@ -88,7 +88,7 @@ SourceProductionContext context currentNode = newNode; } } - NextFieldPass1: + NextFieldPass1: ; } diff --git a/ObsWebSocket.Codegen.Tasks/Generation/Emitter.JsonContext.cs b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.JsonContext.cs new file mode 100644 index 0000000..3568b9e --- /dev/null +++ b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.JsonContext.cs @@ -0,0 +1,136 @@ +using System.Text; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Text; + +namespace ObsWebSocket.Codegen.Tasks.Generation; + +/// +/// Contains emitter logic for generating a System.Text.Json source generation context. +/// +internal static partial class Emitter +{ + /// + /// Generates a JsonSerializerContext containing all fixed and generated protocol types. + /// + public static void GenerateJsonSerializerContext( + SourceProductionContext context, + ProtocolDefinition protocol + ) + { + try + { + StringBuilder builder = BuildSourceHeader("// Serialization Context: ObsWebSocketJsonContext"); + + _ = builder.AppendLine("using System.Collections.Generic;"); + _ = builder.AppendLine("using System.Text.Json;"); + _ = builder.AppendLine("using System.Text.Json.Serialization;"); + _ = builder.AppendLine("using ObsWebSocket.Core.Protocol;"); + _ = builder.AppendLine("using ObsWebSocket.Core.Protocol.Common;"); + _ = builder.AppendLine("using ObsWebSocket.Core.Protocol.Events;"); + _ = builder.AppendLine("using ObsWebSocket.Core.Protocol.Requests;"); + _ = builder.AppendLine("using ObsWebSocket.Core.Protocol.Responses;"); + _ = builder.AppendLine(); + _ = builder.AppendLine("namespace ObsWebSocket.Core.Serialization;"); + _ = builder.AppendLine(); + _ = builder.AppendLine("[JsonSourceGenerationOptions("); + _ = builder.AppendLine(" PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,"); + _ = builder.AppendLine(" DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault)]"); + + // Fixed protocol wrapper and payload types. + _ = builder.AppendLine("[JsonSerializable(typeof(OutgoingMessage))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(OutgoingMessage))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(OutgoingMessage))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(OutgoingMessage))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(IncomingMessage))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(RequestResponsePayload))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(RequestBatchResponsePayload))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(EventPayloadBase))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(HelloPayload))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(IdentifiedPayload))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(RequestStatus))]"); + + // Handwritten stub types. + _ = builder.AppendLine("[JsonSerializable(typeof(SceneStub))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(SceneItemStub))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(SceneItemTransformStub))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(FilterStub))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(InputStub))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(TransitionStub))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(OutputStub))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(MonitorStub))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(PropertyItemStub))]"); + + // Common collection payload helpers. + _ = builder.AppendLine("[JsonSerializable(typeof(List))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(Dictionary))]"); + _ = builder.AppendLine("[JsonSerializable(typeof(Dictionary))]"); + _ = builder.AppendLine( + "[JsonSerializable(typeof(List>))]" + ); + + // Generated request/response/event DTOs. + if (protocol.Requests is not null) + { + foreach (RequestDefinition request in protocol.Requests) + { + string baseName = SanitizeIdentifier(request.RequestType); + if (request.RequestFields?.Count > 0) + { + _ = builder.AppendLine( + $"[JsonSerializable(typeof({GeneratedRequestsNamespace}.{baseName}RequestData))]" + ); + } + + if (request.ResponseFields?.Count > 0) + { + _ = builder.AppendLine( + $"[JsonSerializable(typeof({GeneratedResponsesNamespace}.{baseName}ResponseData))]" + ); + } + } + } + + if (protocol.Events is not null) + { + foreach (OBSEvent eventDef in protocol.Events) + { + if (eventDef.DataFields?.Count > 0) + { + string payloadType = SanitizeIdentifier(eventDef.EventType) + "Payload"; + _ = builder.AppendLine( + $"[JsonSerializable(typeof({GeneratedEventsNamespace}.{payloadType}))]" + ); + } + } + } + + foreach (string nestedTypeName in s_generatedNestedTypes.Keys.OrderBy(k => k)) + { + _ = builder.AppendLine( + $"[JsonSerializable(typeof({NestedTypesNamespace}.{nestedTypeName}))]" + ); + } + + _ = builder.AppendLine("internal sealed partial class ObsWebSocketJsonContext : JsonSerializerContext"); + _ = builder.AppendLine("{"); + _ = builder.AppendLine("}"); + + context.AddSource( + "ObsWebSocketJsonContext.g.cs", + SourceText.From(builder.ToString(), Encoding.UTF8) + ); + } + catch (Exception ex) + { + context.ReportDiagnostic( + Diagnostic.Create( + Diagnostics.IdentifierGenerationError, + Location.None, + "ObsWebSocketJsonContext", + "JsonSerializerContext generation", + ex.ToString() + ) + ); + } + } +} diff --git a/ObsWebSocket.Codegen.Tasks/Generation/Emitter.MsgPackResolver.cs b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.MsgPackResolver.cs new file mode 100644 index 0000000..2d1d188 --- /dev/null +++ b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.MsgPackResolver.cs @@ -0,0 +1,232 @@ +using System.Text; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Text; + +namespace ObsWebSocket.Codegen.Tasks.Generation; + +/// +/// Contains emitter logic for generating a MessagePack resolver for generated protocol types. +/// +internal static partial class Emitter +{ + /// + /// Generates a MessagePack formatter resolver for generated request/response/event and nested DTOs. + /// + public static void GenerateMsgPackResolver( + SourceProductionContext context, + ProtocolDefinition protocol + ) + { + try + { + List fixedTypeNames = []; + List requestTypeNames = []; + List responseTypeNames = []; + List eventTypeNames = []; + List nestedTypeNames = []; + HashSet seen = new(StringComparer.Ordinal); + + void AddFixedType(string typeName) + { + if (seen.Add(typeName)) + { + fixedTypeNames.Add(typeName); + } + } + + AddFixedType("ObsWebSocket.Core.Protocol.HelloPayload"); + AddFixedType("ObsWebSocket.Core.Protocol.AuthenticationData"); + AddFixedType("ObsWebSocket.Core.Protocol.IdentifyPayload"); + AddFixedType("ObsWebSocket.Core.Protocol.IdentifiedPayload"); + AddFixedType("ObsWebSocket.Core.Protocol.ReidentifyPayload"); + AddFixedType("ObsWebSocket.Core.Protocol.RequestPayload"); + AddFixedType("ObsWebSocket.Core.Protocol.RequestBatchPayload"); + AddFixedType("ObsWebSocket.Core.Protocol.RequestStatus"); + + if (protocol.Requests is not null) + { + foreach (RequestDefinition request in protocol.Requests) + { + string baseName = SanitizeIdentifier(request.RequestType); + if (request.RequestFields?.Count > 0) + { + string typeName = $"{GeneratedRequestsNamespace}.{baseName}RequestData"; + if (seen.Add(typeName)) + { + requestTypeNames.Add(typeName); + } + } + + if (request.ResponseFields?.Count > 0) + { + string typeName = $"{GeneratedResponsesNamespace}.{baseName}ResponseData"; + if (seen.Add(typeName)) + { + responseTypeNames.Add(typeName); + } + } + } + } + + if (protocol.Events is not null) + { + foreach (OBSEvent eventDef in protocol.Events) + { + if (eventDef.DataFields?.Count > 0) + { + string payloadType = SanitizeIdentifier(eventDef.EventType) + "Payload"; + string typeName = $"{GeneratedEventsNamespace}.{payloadType}"; + if (seen.Add(typeName)) + { + eventTypeNames.Add(typeName); + } + } + } + } + + foreach (string nestedTypeName in s_generatedNestedTypes.Keys.OrderBy(k => k)) + { + string typeName = $"{NestedTypesNamespace}.{nestedTypeName}"; + if (seen.Add(typeName)) + { + nestedTypeNames.Add(typeName); + } + } + + context.AddSource( + "ObsWebSocketMsgPackResolver.g.cs", + SourceText.From(BuildResolverRootSource(), Encoding.UTF8) + ); + + context.AddSource( + "ObsWebSocketMsgPackResolver.FixedTypes.g.cs", + SourceText.From(BuildKnownTypeSource("IsFixedType", fixedTypeNames), Encoding.UTF8) + ); + + context.AddSource( + "ObsWebSocketMsgPackResolver.RequestTypes.g.cs", + SourceText.From(BuildKnownTypeSource("IsRequestType", requestTypeNames), Encoding.UTF8) + ); + + context.AddSource( + "ObsWebSocketMsgPackResolver.ResponseTypes.g.cs", + SourceText.From(BuildKnownTypeSource("IsResponseType", responseTypeNames), Encoding.UTF8) + ); + + context.AddSource( + "ObsWebSocketMsgPackResolver.EventTypes.g.cs", + SourceText.From(BuildKnownTypeSource("IsEventType", eventTypeNames), Encoding.UTF8) + ); + + context.AddSource( + "ObsWebSocketMsgPackResolver.NestedTypes.g.cs", + SourceText.From(BuildKnownTypeSource("IsNestedType", nestedTypeNames), Encoding.UTF8) + ); + } + catch (Exception ex) + { + context.ReportDiagnostic( + Diagnostic.Create( + Diagnostics.IdentifierGenerationError, + Location.None, + "ObsWebSocketMsgPackResolver", + "MessagePack resolver generation", + ex.ToString() + ) + ); + } + } + + private static string BuildResolverRootSource() + { + StringBuilder builder = BuildSourceHeader("// Serialization Resolver: ObsWebSocketMsgPackResolver"); + builder.AppendLine("using System;"); + builder.AppendLine("using MessagePack;"); + builder.AppendLine("using MessagePack.Formatters;"); + builder.AppendLine("using MessagePack.Resolvers;"); + builder.AppendLine(); + builder.AppendLine("namespace ObsWebSocket.Core.Serialization;"); + builder.AppendLine(); + builder.AppendLine("/// "); + builder.AppendLine("/// MessagePack resolver for OBS WebSocket protocol DTOs."); + builder.AppendLine("/// "); + builder.AppendLine("public sealed class ObsWebSocketMsgPackResolver : IFormatterResolver"); + builder.AppendLine("{"); + builder.AppendLine(" /// "); + builder.AppendLine(" /// Singleton resolver instance."); + builder.AppendLine(" /// "); + builder.AppendLine( + " public static readonly IFormatterResolver Instance = new ObsWebSocketMsgPackResolver();" + ); + builder.AppendLine(); + builder.AppendLine(" private ObsWebSocketMsgPackResolver() { }"); + builder.AppendLine(); + builder.AppendLine(" /// "); + builder.AppendLine(" /// Gets a formatter for when this resolver supports it."); + builder.AppendLine(" /// "); + builder.AppendLine( + " public IMessagePackFormatter? GetFormatter() => ObsWebSocketMsgPackResolverCore.GetFormatter();" + ); + builder.AppendLine("}"); + builder.AppendLine(); + builder.AppendLine("internal static partial class ObsWebSocketMsgPackResolverCore"); + builder.AppendLine("{"); + builder.AppendLine(" public static IMessagePackFormatter? GetFormatter()"); + builder.AppendLine(" {"); + builder.AppendLine(" Type type = typeof(T);"); + builder.AppendLine(" if (!IsKnownType(type))"); + builder.AppendLine(" {"); + builder.AppendLine(" return null;"); + builder.AppendLine(" }"); + builder.AppendLine(); + builder.AppendLine(" return SourceGeneratedFormatterResolver.Instance.GetFormatter();"); + builder.AppendLine(" }"); + builder.AppendLine(); + builder.AppendLine(" private static bool IsKnownType(Type type)"); + builder.AppendLine(" {"); + builder.AppendLine( + " return IsFixedType(type) || IsRequestType(type) || IsResponseType(type) || IsEventType(type) || IsNestedType(type);" + ); + builder.AppendLine(" }"); + builder.AppendLine(); + builder.AppendLine(" private static partial bool IsFixedType(Type type);"); + builder.AppendLine(" private static partial bool IsRequestType(Type type);"); + builder.AppendLine(" private static partial bool IsResponseType(Type type);"); + builder.AppendLine(" private static partial bool IsEventType(Type type);"); + builder.AppendLine(" private static partial bool IsNestedType(Type type);"); + builder.AppendLine("}"); + + return builder.ToString(); + } + + private static string BuildKnownTypeSource(string methodName, List typeNames) + { + StringBuilder builder = BuildSourceHeader("// Serialization Resolver Type Map"); + builder.AppendLine("using System;"); + builder.AppendLine(); + builder.AppendLine("namespace ObsWebSocket.Core.Serialization;"); + builder.AppendLine(); + builder.AppendLine("internal static partial class ObsWebSocketMsgPackResolverCore"); + builder.AppendLine("{"); + builder.AppendLine($" private static partial bool {methodName}(Type type)"); + builder.AppendLine(" {"); + + if (typeNames.Count == 0) + { + builder.AppendLine(" return false;"); + } + else + { + builder.AppendLine(" return"); + for (int i = 0; i < typeNames.Count; i++) + { + string suffix = i == typeNames.Count - 1 ? ";" : " ||"; + builder.AppendLine($" type == typeof({typeNames[i]}){suffix}"); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return builder.ToString(); + } +} diff --git a/ObsWebSocket.SourceGenerators/Emitter.WaitForEvent.cs b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.WaitForEvent.cs similarity index 99% rename from ObsWebSocket.SourceGenerators/Emitter.WaitForEvent.cs rename to ObsWebSocket.Codegen.Tasks/Generation/Emitter.WaitForEvent.cs index 30bd219..5a30eba 100644 --- a/ObsWebSocket.SourceGenerators/Emitter.WaitForEvent.cs +++ b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.WaitForEvent.cs @@ -1,9 +1,9 @@ -// ObsWebSocket.SourceGenerators/Emitter.WaitForEvent.cs +// ObsWebSocket.Codegen.Tasks/Generation/Emitter.WaitForEvent.cs using System.Text; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Text; -namespace ObsWebSocket.SourceGenerators; +namespace ObsWebSocket.Codegen.Tasks.Generation; /// /// Contains emitter logic specifically for generating the WaitForEventAsync helper method. diff --git a/ObsWebSocket.SourceGenerators/Emitter.cs b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.cs similarity index 99% rename from ObsWebSocket.SourceGenerators/Emitter.cs rename to ObsWebSocket.Codegen.Tasks/Generation/Emitter.cs index c9c3b80..e27ea9c 100644 --- a/ObsWebSocket.SourceGenerators/Emitter.cs +++ b/ObsWebSocket.Codegen.Tasks/Generation/Emitter.cs @@ -1,9 +1,9 @@ -using System.Text; +using System.Text; using System.Text.Json; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Text; // Required for SourceText -namespace ObsWebSocket.SourceGenerators; +namespace ObsWebSocket.Codegen.Tasks.Generation; /// /// Main entry point for the Emitter logic. Combines helpers and generation methods. diff --git a/ObsWebSocket.Codegen.Tasks/Generation/GenerationContext.cs b/ObsWebSocket.Codegen.Tasks/Generation/GenerationContext.cs new file mode 100644 index 0000000..5176b21 --- /dev/null +++ b/ObsWebSocket.Codegen.Tasks/Generation/GenerationContext.cs @@ -0,0 +1,66 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Text; + +namespace ObsWebSocket.Codegen.Tasks.Generation; + +internal sealed class GenerationContext +{ + private readonly List _diagnostics = []; + private readonly Dictionary _sources = new(StringComparer.OrdinalIgnoreCase); + + public IReadOnlyList Diagnostics => _diagnostics; + + public IReadOnlyDictionary Sources => _sources; + + public void AddSource(string hintName, SourceText sourceText) + { + ArgumentException.ThrowIfNullOrEmpty(hintName); + ArgumentNullException.ThrowIfNull(sourceText); + + string relativePath = ResolveOutputPath(hintName, sourceText.ToString()); + _sources[relativePath] = sourceText.ToString(); + } + + public void ReportDiagnostic(Diagnostic diagnostic) => _diagnostics.Add(diagnostic); + + private static string ResolveOutputPath(string hintName, string source) + { + string fileName = Path.GetFileName(hintName); + string namespaceLine = source + .Split('\n') + .Select(line => line.Trim()) + .FirstOrDefault(line => line.StartsWith("namespace ", StringComparison.Ordinal)) + ?? string.Empty; + + if (namespaceLine.Contains("ObsWebSocket.Core.Protocol.Common.NestedTypes", StringComparison.Ordinal)) + { + return Path.Combine("Protocol", "Common", "NestedTypes", fileName); + } + + if (namespaceLine.Contains("ObsWebSocket.Core.Protocol.Requests", StringComparison.Ordinal)) + { + return Path.Combine("Protocol", "Requests", fileName); + } + + if (namespaceLine.Contains("ObsWebSocket.Core.Protocol.Responses", StringComparison.Ordinal)) + { + return Path.Combine("Protocol", "Responses", fileName); + } + + if (namespaceLine.Contains("ObsWebSocket.Core.Protocol.Events", StringComparison.Ordinal)) + { + return Path.Combine("Protocol", "Events", fileName); + } + + if (namespaceLine.Contains("ObsWebSocket.Core.Protocol.Generated", StringComparison.Ordinal)) + { + return Path.Combine("Protocol", "Generated", fileName); + } + + return namespaceLine.Contains("ObsWebSocket.Core.Events.Generated", StringComparison.Ordinal) + ? Path.Combine("Events", "Generated", fileName) + : namespaceLine.Contains("ObsWebSocket.Core.Serialization", StringComparison.Ordinal) + ? Path.Combine("Serialization", fileName) + : Path.Combine("Client", fileName); + } +} diff --git a/ObsWebSocket.Codegen.Tasks/Generation/GlobalUsings.cs b/ObsWebSocket.Codegen.Tasks/Generation/GlobalUsings.cs new file mode 100644 index 0000000..91c1a2e --- /dev/null +++ b/ObsWebSocket.Codegen.Tasks/Generation/GlobalUsings.cs @@ -0,0 +1 @@ +global using SourceProductionContext = ObsWebSocket.Codegen.Tasks.Generation.GenerationContext; diff --git a/ObsWebSocket.Codegen.Tasks/Generation/ProtocolCodeGenerator.cs b/ObsWebSocket.Codegen.Tasks/Generation/ProtocolCodeGenerator.cs new file mode 100644 index 0000000..237c1e9 --- /dev/null +++ b/ObsWebSocket.Codegen.Tasks/Generation/ProtocolCodeGenerator.cs @@ -0,0 +1,41 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using Microsoft.CodeAnalysis; + +namespace ObsWebSocket.Codegen.Tasks.Generation; + +internal static class ProtocolCodeGenerator +{ + private static readonly JsonSerializerOptions s_jsonOptions = new() + { + PropertyNameCaseInsensitive = true, + NumberHandling = JsonNumberHandling.AllowReadingFromString, + }; + + public static (IReadOnlyDictionary Sources, IReadOnlyList Diagnostics) Generate(string protocolJson) + { + ArgumentException.ThrowIfNullOrEmpty(protocolJson); + + GenerationContext context = new(); + ProtocolDefinition? protocol = JsonSerializer.Deserialize(protocolJson, s_jsonOptions); + if (protocol is null) + { + context.ReportDiagnostic(Diagnostic.Create(Diagnostics.ProtocolJsonParseError, Location.None, "Deserialization returned null.")); + return (context.Sources, context.Diagnostics); + } + + Emitter.PreGenerateNestedDtos(context, protocol); + Emitter.GenerateEnums(context, protocol); + Emitter.GenerateRequestDtos(context, protocol); + Emitter.GenerateResponseDtos(context, protocol); + Emitter.GenerateClientExtensions(context, protocol); + Emitter.GenerateEventPayloads(context, protocol); + Emitter.GenerateEventArgs(context, protocol); + Emitter.GenerateClientEventInfrastructure(context, protocol); + Emitter.GenerateWaitForEventHelper(context, protocol); + Emitter.GenerateJsonSerializerContext(context, protocol); + Emitter.GenerateMsgPackResolver(context, protocol); + + return (context.Sources, context.Diagnostics); + } +} diff --git a/ObsWebSocket.SourceGenerators/ProtocolModel.cs b/ObsWebSocket.Codegen.Tasks/Generation/ProtocolModel.cs similarity index 99% rename from ObsWebSocket.SourceGenerators/ProtocolModel.cs rename to ObsWebSocket.Codegen.Tasks/Generation/ProtocolModel.cs index f73c2e4..cf6b912 100644 --- a/ObsWebSocket.SourceGenerators/ProtocolModel.cs +++ b/ObsWebSocket.Codegen.Tasks/Generation/ProtocolModel.cs @@ -1,7 +1,7 @@ -using System.Text.Json; +using System.Text.Json; using System.Text.Json.Serialization; -namespace ObsWebSocket.SourceGenerators; +namespace ObsWebSocket.Codegen.Tasks.Generation; /// /// Represents the definition of a single event type in the protocol. diff --git a/ObsWebSocket.Codegen.Tasks/ObsWebSocket.Codegen.Tasks.csproj b/ObsWebSocket.Codegen.Tasks/ObsWebSocket.Codegen.Tasks.csproj new file mode 100644 index 0000000..a48436b --- /dev/null +++ b/ObsWebSocket.Codegen.Tasks/ObsWebSocket.Codegen.Tasks.csproj @@ -0,0 +1,16 @@ + + + + net9.0 + enable + enable + $(NoWarn);RS2008 + + + + + + + + + diff --git a/ObsWebSocket.Codegen.Tasks/ProtocolCodegenRunner.cs b/ObsWebSocket.Codegen.Tasks/ProtocolCodegenRunner.cs new file mode 100644 index 0000000..cb4bbeb --- /dev/null +++ b/ObsWebSocket.Codegen.Tasks/ProtocolCodegenRunner.cs @@ -0,0 +1,121 @@ +using System.Text; +using Microsoft.CodeAnalysis; +using ObsWebSocket.Codegen.Tasks.Generation; + +namespace ObsWebSocket.Codegen.Tasks; + +internal static class ProtocolCodegenRunner +{ + private const string ProtocolUrl = "https://raw.githubusercontent.com/obsproject/obs-websocket/master/docs/generated/protocol.json"; + + public static async Task GenerateAsync( + string protocolPath, + string outputDirectory, + bool downloadIfMissing, + CancellationToken cancellationToken, + Action? logInfo = null, + Action? logWarning = null, + Action? logError = null + ) + { + ArgumentException.ThrowIfNullOrEmpty(protocolPath); + ArgumentException.ThrowIfNullOrEmpty(outputDirectory); + + try + { + string fullProtocolPath = Path.GetFullPath(protocolPath); + string fullOutputDirectory = Path.GetFullPath(outputDirectory); + + if (!File.Exists(fullProtocolPath)) + { + if (!downloadIfMissing) + { + logError?.Invoke($"Protocol file not found: {fullProtocolPath}"); + return 2; + } + + await DownloadProtocolAsync(fullProtocolPath, cancellationToken).ConfigureAwait(false); + logInfo?.Invoke($"Downloaded protocol.json to '{fullProtocolPath}'."); + } + + string protocolJson = await File.ReadAllTextAsync(fullProtocolPath, cancellationToken).ConfigureAwait(false); + (IReadOnlyDictionary sources, IReadOnlyList diagnostics) = ProtocolCodeGenerator.Generate(protocolJson); + + Diagnostic[] errors = [.. diagnostics.Where(d => d.Severity == DiagnosticSeverity.Error)]; + Diagnostic[] warnings = [.. diagnostics.Where(d => d.Severity == DiagnosticSeverity.Warning)]; + Diagnostic[] infos = [.. diagnostics.Where(d => d.Severity == DiagnosticSeverity.Info)]; + if (errors.Length > 0) + { + StringBuilder builder = new(); + _ = builder.AppendLine("Code generation failed:"); + foreach (Diagnostic diagnostic in errors) + { + _ = builder.AppendLine(diagnostic.ToString()); + } + + logError?.Invoke(builder.ToString()); + return 1; + } + + foreach (Diagnostic warning in warnings) + { + logWarning?.Invoke(warning.ToString()); + } + + foreach (Diagnostic info in infos) + { + logInfo?.Invoke(info.ToString()); + } + + WriteSources(fullOutputDirectory, sources); + logInfo?.Invoke($"Generated {sources.Count} source files to '{fullOutputDirectory}'."); + + return 0; + } + catch (Exception ex) + { + logError?.Invoke(ex.ToString()); + return 1; + } + } + + private static async Task DownloadProtocolAsync(string protocolPath, CancellationToken cancellationToken) + { + _ = Directory.CreateDirectory(Path.GetDirectoryName(protocolPath)!); + using HttpClient http = new(); + using HttpResponseMessage response = await http.GetAsync(ProtocolUrl, cancellationToken).ConfigureAwait(false); + _ = response.EnsureSuccessStatusCode(); + string protocolJson = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + await File.WriteAllTextAsync(protocolPath, protocolJson, new UTF8Encoding(false), cancellationToken).ConfigureAwait(false); + } + + private static void WriteSources(string outputDirectory, IReadOnlyDictionary sources) + { + _ = Directory.CreateDirectory(outputDirectory); + + HashSet generatedRelativePaths = sources.Keys + .Select(NormalizeRelativePath) + .ToHashSet(StringComparer.OrdinalIgnoreCase); + + foreach (string existingFile in Directory.GetFiles(outputDirectory, "*.g.cs", SearchOption.AllDirectories)) + { + string relativePath = NormalizeRelativePath(Path.GetRelativePath(outputDirectory, existingFile)); + if (!generatedRelativePaths.Contains(relativePath)) + { + File.Delete(existingFile); + } + } + + foreach ((string relativePath, string source) in sources) + { + string normalizedRelativePath = NormalizeRelativePath(relativePath); + string outputPath = Path.Combine(outputDirectory, normalizedRelativePath); + _ = Directory.CreateDirectory(Path.GetDirectoryName(outputPath)!); + File.WriteAllText(outputPath, source, new UTF8Encoding(false)); + } + } + + private static string NormalizeRelativePath(string path) => path + .Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar) + .TrimStart(Path.DirectorySeparatorChar); +} diff --git a/ObsWebSocket.Core/Generated/Client/ObsWebSocketClient.Events.g.cs b/ObsWebSocket.Core/Generated/Client/ObsWebSocketClient.Events.g.cs new file mode 100644 index 0000000..fff5187 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Client/ObsWebSocketClient.Events.g.cs @@ -0,0 +1,1076 @@ +// +#nullable enable + +using System; +using ObsWebSocket.Core.Events.Generated; + +namespace ObsWebSocket.Core; + +/// +/// Contains generated event fields and the corresponding invoker methods +/// for the , based on the OBS WebSocket protocol definition. +/// +public sealed partial class ObsWebSocketClient +{ + + /// + /// Occurs when the CurrentSceneCollectionChanging event is received from the OBS WebSocket server. + /// + /// + /// The current scene collection has begun changing. + /// + /// Note: We recommend using this event to trigger a pause of all polling requests, as performing any requests during a + /// scene collection change is considered undefined behavior and can cause crashes! + /// Requires the Config subscription. + /// Category: config | Complexity: 1 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? CurrentSceneCollectionChanging; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnCurrentSceneCollectionChanging(ObsWebSocket.Core.Events.Generated.CurrentSceneCollectionChangingEventArgs e) + { + CurrentSceneCollectionChanging?.Invoke(this, e); + } + + /// + /// Occurs when the CurrentSceneCollectionChanged event is received from the OBS WebSocket server. + /// + /// + /// The current scene collection has changed. + /// + /// Note: If polling has been paused during `CurrentSceneCollectionChanging`, this is the que to restart polling. + /// Requires the Config subscription. + /// Category: config | Complexity: 1 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? CurrentSceneCollectionChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnCurrentSceneCollectionChanged(ObsWebSocket.Core.Events.Generated.CurrentSceneCollectionChangedEventArgs e) + { + CurrentSceneCollectionChanged?.Invoke(this, e); + } + + /// + /// Occurs when the SceneCollectionListChanged event is received from the OBS WebSocket server. + /// + /// + /// The scene collection list has changed. + /// Requires the Config subscription. + /// Category: config | Complexity: 1 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneCollectionListChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneCollectionListChanged(ObsWebSocket.Core.Events.Generated.SceneCollectionListChangedEventArgs e) + { + SceneCollectionListChanged?.Invoke(this, e); + } + + /// + /// Occurs when the CurrentProfileChanging event is received from the OBS WebSocket server. + /// + /// + /// The current profile has begun changing. + /// Requires the Config subscription. + /// Category: config | Complexity: 1 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? CurrentProfileChanging; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnCurrentProfileChanging(ObsWebSocket.Core.Events.Generated.CurrentProfileChangingEventArgs e) + { + CurrentProfileChanging?.Invoke(this, e); + } + + /// + /// Occurs when the CurrentProfileChanged event is received from the OBS WebSocket server. + /// + /// + /// The current profile has changed. + /// Requires the Config subscription. + /// Category: config | Complexity: 1 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? CurrentProfileChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnCurrentProfileChanged(ObsWebSocket.Core.Events.Generated.CurrentProfileChangedEventArgs e) + { + CurrentProfileChanged?.Invoke(this, e); + } + + /// + /// Occurs when the ProfileListChanged event is received from the OBS WebSocket server. + /// + /// + /// The profile list has changed. + /// Requires the Config subscription. + /// Category: config | Complexity: 1 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? ProfileListChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnProfileListChanged(ObsWebSocket.Core.Events.Generated.ProfileListChangedEventArgs e) + { + ProfileListChanged?.Invoke(this, e); + } + + /// + /// Occurs when the SourceFilterListReindexed event is received from the OBS WebSocket server. + /// + /// + /// A source's filter list has been reindexed. + /// Requires the Filters subscription. + /// Category: filters | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SourceFilterListReindexed; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSourceFilterListReindexed(ObsWebSocket.Core.Events.Generated.SourceFilterListReindexedEventArgs e) + { + SourceFilterListReindexed?.Invoke(this, e); + } + + /// + /// Occurs when the SourceFilterCreated event is received from the OBS WebSocket server. + /// + /// + /// A filter has been added to a source. + /// Requires the Filters subscription. + /// Category: filters | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SourceFilterCreated; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSourceFilterCreated(ObsWebSocket.Core.Events.Generated.SourceFilterCreatedEventArgs e) + { + SourceFilterCreated?.Invoke(this, e); + } + + /// + /// Occurs when the SourceFilterRemoved event is received from the OBS WebSocket server. + /// + /// + /// A filter has been removed from a source. + /// Requires the Filters subscription. + /// Category: filters | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SourceFilterRemoved; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSourceFilterRemoved(ObsWebSocket.Core.Events.Generated.SourceFilterRemovedEventArgs e) + { + SourceFilterRemoved?.Invoke(this, e); + } + + /// + /// Occurs when the SourceFilterNameChanged event is received from the OBS WebSocket server. + /// + /// + /// The name of a source filter has changed. + /// Requires the Filters subscription. + /// Category: filters | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SourceFilterNameChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSourceFilterNameChanged(ObsWebSocket.Core.Events.Generated.SourceFilterNameChangedEventArgs e) + { + SourceFilterNameChanged?.Invoke(this, e); + } + + /// + /// Occurs when the SourceFilterSettingsChanged event is received from the OBS WebSocket server. + /// + /// + /// An source filter's settings have changed (been updated). + /// Requires the Filters subscription. + /// Category: filters | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.4.0 + /// + public event EventHandler? SourceFilterSettingsChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSourceFilterSettingsChanged(ObsWebSocket.Core.Events.Generated.SourceFilterSettingsChangedEventArgs e) + { + SourceFilterSettingsChanged?.Invoke(this, e); + } + + /// + /// Occurs when the SourceFilterEnableStateChanged event is received from the OBS WebSocket server. + /// + /// + /// A source filter's enable state has changed. + /// Requires the Filters subscription. + /// Category: filters | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SourceFilterEnableStateChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSourceFilterEnableStateChanged(ObsWebSocket.Core.Events.Generated.SourceFilterEnableStateChangedEventArgs e) + { + SourceFilterEnableStateChanged?.Invoke(this, e); + } + + /// + /// Occurs when the ExitStarted event is received from the OBS WebSocket server. + /// + /// + /// OBS has begun the shutdown process. + /// Requires the General subscription. + /// Category: general | Complexity: 1 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? ExitStarted; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnExitStarted(ObsWebSocket.Core.Events.Generated.ExitStartedEventArgs e) + { + ExitStarted?.Invoke(this, e); + } + + /// + /// Occurs when the InputCreated event is received from the OBS WebSocket server. + /// + /// + /// An input has been created. + /// Requires the Inputs subscription. + /// Category: inputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputCreated; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputCreated(ObsWebSocket.Core.Events.Generated.InputCreatedEventArgs e) + { + InputCreated?.Invoke(this, e); + } + + /// + /// Occurs when the InputRemoved event is received from the OBS WebSocket server. + /// + /// + /// An input has been removed. + /// Requires the Inputs subscription. + /// Category: inputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputRemoved; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputRemoved(ObsWebSocket.Core.Events.Generated.InputRemovedEventArgs e) + { + InputRemoved?.Invoke(this, e); + } + + /// + /// Occurs when the InputNameChanged event is received from the OBS WebSocket server. + /// + /// + /// The name of an input has changed. + /// Requires the Inputs subscription. + /// Category: inputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputNameChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputNameChanged(ObsWebSocket.Core.Events.Generated.InputNameChangedEventArgs e) + { + InputNameChanged?.Invoke(this, e); + } + + /// + /// Occurs when the InputSettingsChanged event is received from the OBS WebSocket server. + /// + /// + /// An input's settings have changed (been updated). + /// + /// Note: On some inputs, changing values in the properties dialog will cause an immediate update. Pressing the "Cancel" button will revert the settings, resulting in another event being fired. + /// Requires the Inputs subscription. + /// Category: inputs | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.4.0 + /// + public event EventHandler? InputSettingsChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputSettingsChanged(ObsWebSocket.Core.Events.Generated.InputSettingsChangedEventArgs e) + { + InputSettingsChanged?.Invoke(this, e); + } + + /// + /// Occurs when the InputActiveStateChanged event is received from the OBS WebSocket server. + /// + /// + /// An input's active state has changed. + /// + /// When an input is active, it means it's being shown by the program feed. + /// Requires the InputActiveStateChanged subscription. + /// Category: inputs | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputActiveStateChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputActiveStateChanged(ObsWebSocket.Core.Events.Generated.InputActiveStateChangedEventArgs e) + { + InputActiveStateChanged?.Invoke(this, e); + } + + /// + /// Occurs when the InputShowStateChanged event is received from the OBS WebSocket server. + /// + /// + /// An input's show state has changed. + /// + /// When an input is showing, it means it's being shown by the preview or a dialog. + /// Requires the InputShowStateChanged subscription. + /// Category: inputs | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputShowStateChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputShowStateChanged(ObsWebSocket.Core.Events.Generated.InputShowStateChangedEventArgs e) + { + InputShowStateChanged?.Invoke(this, e); + } + + /// + /// Occurs when the InputMuteStateChanged event is received from the OBS WebSocket server. + /// + /// + /// An input's mute state has changed. + /// Requires the Inputs subscription. + /// Category: inputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputMuteStateChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputMuteStateChanged(ObsWebSocket.Core.Events.Generated.InputMuteStateChangedEventArgs e) + { + InputMuteStateChanged?.Invoke(this, e); + } + + /// + /// Occurs when the InputVolumeChanged event is received from the OBS WebSocket server. + /// + /// + /// An input's volume level has changed. + /// Requires the Inputs subscription. + /// Category: inputs | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputVolumeChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputVolumeChanged(ObsWebSocket.Core.Events.Generated.InputVolumeChangedEventArgs e) + { + InputVolumeChanged?.Invoke(this, e); + } + + /// + /// Occurs when the InputAudioBalanceChanged event is received from the OBS WebSocket server. + /// + /// + /// The audio balance value of an input has changed. + /// Requires the Inputs subscription. + /// Category: inputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputAudioBalanceChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputAudioBalanceChanged(ObsWebSocket.Core.Events.Generated.InputAudioBalanceChangedEventArgs e) + { + InputAudioBalanceChanged?.Invoke(this, e); + } + + /// + /// Occurs when the InputAudioSyncOffsetChanged event is received from the OBS WebSocket server. + /// + /// + /// The sync offset of an input has changed. + /// Requires the Inputs subscription. + /// Category: inputs | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputAudioSyncOffsetChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputAudioSyncOffsetChanged(ObsWebSocket.Core.Events.Generated.InputAudioSyncOffsetChangedEventArgs e) + { + InputAudioSyncOffsetChanged?.Invoke(this, e); + } + + /// + /// Occurs when the InputAudioTracksChanged event is received from the OBS WebSocket server. + /// + /// + /// The audio tracks of an input have changed. + /// Requires the Inputs subscription. + /// Category: inputs | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputAudioTracksChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputAudioTracksChanged(ObsWebSocket.Core.Events.Generated.InputAudioTracksChangedEventArgs e) + { + InputAudioTracksChanged?.Invoke(this, e); + } + + /// + /// Occurs when the InputAudioMonitorTypeChanged event is received from the OBS WebSocket server. + /// + /// + /// The monitor type of an input has changed. + /// + /// Available types are: + /// + /// - `OBS_MONITORING_TYPE_NONE` + /// - `OBS_MONITORING_TYPE_MONITOR_ONLY` + /// - `OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT` + /// Requires the Inputs subscription. + /// Category: inputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputAudioMonitorTypeChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputAudioMonitorTypeChanged(ObsWebSocket.Core.Events.Generated.InputAudioMonitorTypeChangedEventArgs e) + { + InputAudioMonitorTypeChanged?.Invoke(this, e); + } + + /// + /// Occurs when the InputVolumeMeters event is received from the OBS WebSocket server. + /// + /// + /// A high-volume event providing volume levels of all active inputs every 50 milliseconds. + /// Requires the InputVolumeMeters subscription. + /// Category: inputs | Complexity: 4 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? InputVolumeMeters; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnInputVolumeMeters(ObsWebSocket.Core.Events.Generated.InputVolumeMetersEventArgs e) + { + InputVolumeMeters?.Invoke(this, e); + } + + /// + /// Occurs when the MediaInputPlaybackStarted event is received from the OBS WebSocket server. + /// + /// + /// A media input has started playing. + /// Requires the MediaInputs subscription. + /// Category: media inputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? MediaInputPlaybackStarted; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnMediaInputPlaybackStarted(ObsWebSocket.Core.Events.Generated.MediaInputPlaybackStartedEventArgs e) + { + MediaInputPlaybackStarted?.Invoke(this, e); + } + + /// + /// Occurs when the MediaInputPlaybackEnded event is received from the OBS WebSocket server. + /// + /// + /// A media input has finished playing. + /// Requires the MediaInputs subscription. + /// Category: media inputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? MediaInputPlaybackEnded; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnMediaInputPlaybackEnded(ObsWebSocket.Core.Events.Generated.MediaInputPlaybackEndedEventArgs e) + { + MediaInputPlaybackEnded?.Invoke(this, e); + } + + /// + /// Occurs when the MediaInputActionTriggered event is received from the OBS WebSocket server. + /// + /// + /// An action has been performed on an input. + /// Requires the MediaInputs subscription. + /// Category: media inputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? MediaInputActionTriggered; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnMediaInputActionTriggered(ObsWebSocket.Core.Events.Generated.MediaInputActionTriggeredEventArgs e) + { + MediaInputActionTriggered?.Invoke(this, e); + } + + /// + /// Occurs when the StreamStateChanged event is received from the OBS WebSocket server. + /// + /// + /// The state of the stream output has changed. + /// Requires the Outputs subscription. + /// Category: outputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? StreamStateChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnStreamStateChanged(ObsWebSocket.Core.Events.Generated.StreamStateChangedEventArgs e) + { + StreamStateChanged?.Invoke(this, e); + } + + /// + /// Occurs when the RecordStateChanged event is received from the OBS WebSocket server. + /// + /// + /// The state of the record output has changed. + /// Requires the Outputs subscription. + /// Category: outputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? RecordStateChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnRecordStateChanged(ObsWebSocket.Core.Events.Generated.RecordStateChangedEventArgs e) + { + RecordStateChanged?.Invoke(this, e); + } + + /// + /// Occurs when the RecordFileChanged event is received from the OBS WebSocket server. + /// + /// + /// The record output has started writing to a new file. For example, when a file split happens. + /// Requires the Outputs subscription. + /// Category: outputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.5.0 + /// + public event EventHandler? RecordFileChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnRecordFileChanged(ObsWebSocket.Core.Events.Generated.RecordFileChangedEventArgs e) + { + RecordFileChanged?.Invoke(this, e); + } + + /// + /// Occurs when the ReplayBufferStateChanged event is received from the OBS WebSocket server. + /// + /// + /// The state of the replay buffer output has changed. + /// Requires the Outputs subscription. + /// Category: outputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? ReplayBufferStateChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnReplayBufferStateChanged(ObsWebSocket.Core.Events.Generated.ReplayBufferStateChangedEventArgs e) + { + ReplayBufferStateChanged?.Invoke(this, e); + } + + /// + /// Occurs when the VirtualcamStateChanged event is received from the OBS WebSocket server. + /// + /// + /// The state of the virtualcam output has changed. + /// Requires the Outputs subscription. + /// Category: outputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? VirtualcamStateChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnVirtualcamStateChanged(ObsWebSocket.Core.Events.Generated.VirtualcamStateChangedEventArgs e) + { + VirtualcamStateChanged?.Invoke(this, e); + } + + /// + /// Occurs when the ReplayBufferSaved event is received from the OBS WebSocket server. + /// + /// + /// The replay buffer has been saved. + /// Requires the Outputs subscription. + /// Category: outputs | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? ReplayBufferSaved; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnReplayBufferSaved(ObsWebSocket.Core.Events.Generated.ReplayBufferSavedEventArgs e) + { + ReplayBufferSaved?.Invoke(this, e); + } + + /// + /// Occurs when the SceneItemCreated event is received from the OBS WebSocket server. + /// + /// + /// A scene item has been created. + /// Requires the SceneItems subscription. + /// Category: scene items | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneItemCreated; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneItemCreated(ObsWebSocket.Core.Events.Generated.SceneItemCreatedEventArgs e) + { + SceneItemCreated?.Invoke(this, e); + } + + /// + /// Occurs when the SceneItemRemoved event is received from the OBS WebSocket server. + /// + /// + /// A scene item has been removed. + /// + /// This event is not emitted when the scene the item is in is removed. + /// Requires the SceneItems subscription. + /// Category: scene items | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneItemRemoved; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneItemRemoved(ObsWebSocket.Core.Events.Generated.SceneItemRemovedEventArgs e) + { + SceneItemRemoved?.Invoke(this, e); + } + + /// + /// Occurs when the SceneItemListReindexed event is received from the OBS WebSocket server. + /// + /// + /// A scene's item list has been reindexed. + /// Requires the SceneItems subscription. + /// Category: scene items | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneItemListReindexed; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneItemListReindexed(ObsWebSocket.Core.Events.Generated.SceneItemListReindexedEventArgs e) + { + SceneItemListReindexed?.Invoke(this, e); + } + + /// + /// Occurs when the SceneItemEnableStateChanged event is received from the OBS WebSocket server. + /// + /// + /// A scene item's enable state has changed. + /// Requires the SceneItems subscription. + /// Category: scene items | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneItemEnableStateChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneItemEnableStateChanged(ObsWebSocket.Core.Events.Generated.SceneItemEnableStateChangedEventArgs e) + { + SceneItemEnableStateChanged?.Invoke(this, e); + } + + /// + /// Occurs when the SceneItemLockStateChanged event is received from the OBS WebSocket server. + /// + /// + /// A scene item's lock state has changed. + /// Requires the SceneItems subscription. + /// Category: scene items | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneItemLockStateChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneItemLockStateChanged(ObsWebSocket.Core.Events.Generated.SceneItemLockStateChangedEventArgs e) + { + SceneItemLockStateChanged?.Invoke(this, e); + } + + /// + /// Occurs when the SceneItemSelected event is received from the OBS WebSocket server. + /// + /// + /// A scene item has been selected in the Ui. + /// Requires the SceneItems subscription. + /// Category: scene items | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneItemSelected; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneItemSelected(ObsWebSocket.Core.Events.Generated.SceneItemSelectedEventArgs e) + { + SceneItemSelected?.Invoke(this, e); + } + + /// + /// Occurs when the SceneItemTransformChanged event is received from the OBS WebSocket server. + /// + /// + /// The transform/crop of a scene item has changed. + /// Requires the SceneItemTransformChanged subscription. + /// Category: scene items | Complexity: 4 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneItemTransformChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneItemTransformChanged(ObsWebSocket.Core.Events.Generated.SceneItemTransformChangedEventArgs e) + { + SceneItemTransformChanged?.Invoke(this, e); + } + + /// + /// Occurs when the SceneCreated event is received from the OBS WebSocket server. + /// + /// + /// A new scene has been created. + /// Requires the Scenes subscription. + /// Category: scenes | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneCreated; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneCreated(ObsWebSocket.Core.Events.Generated.SceneCreatedEventArgs e) + { + SceneCreated?.Invoke(this, e); + } + + /// + /// Occurs when the SceneRemoved event is received from the OBS WebSocket server. + /// + /// + /// A scene has been removed. + /// Requires the Scenes subscription. + /// Category: scenes | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneRemoved; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneRemoved(ObsWebSocket.Core.Events.Generated.SceneRemovedEventArgs e) + { + SceneRemoved?.Invoke(this, e); + } + + /// + /// Occurs when the SceneNameChanged event is received from the OBS WebSocket server. + /// + /// + /// The name of a scene has changed. + /// Requires the Scenes subscription. + /// Category: scenes | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneNameChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneNameChanged(ObsWebSocket.Core.Events.Generated.SceneNameChangedEventArgs e) + { + SceneNameChanged?.Invoke(this, e); + } + + /// + /// Occurs when the CurrentProgramSceneChanged event is received from the OBS WebSocket server. + /// + /// + /// The current program scene has changed. + /// Requires the Scenes subscription. + /// Category: scenes | Complexity: 1 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? CurrentProgramSceneChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnCurrentProgramSceneChanged(ObsWebSocket.Core.Events.Generated.CurrentProgramSceneChangedEventArgs e) + { + CurrentProgramSceneChanged?.Invoke(this, e); + } + + /// + /// Occurs when the CurrentPreviewSceneChanged event is received from the OBS WebSocket server. + /// + /// + /// The current preview scene has changed. + /// Requires the Scenes subscription. + /// Category: scenes | Complexity: 1 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? CurrentPreviewSceneChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnCurrentPreviewSceneChanged(ObsWebSocket.Core.Events.Generated.CurrentPreviewSceneChangedEventArgs e) + { + CurrentPreviewSceneChanged?.Invoke(this, e); + } + + /// + /// Occurs when the SceneListChanged event is received from the OBS WebSocket server. + /// + /// + /// The list of scenes has changed. + /// + /// TODO: Make OBS fire this event when scenes are reordered. + /// Requires the Scenes subscription. + /// Category: scenes | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneListChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneListChanged(ObsWebSocket.Core.Events.Generated.SceneListChangedEventArgs e) + { + SceneListChanged?.Invoke(this, e); + } + + /// + /// Occurs when the CurrentSceneTransitionChanged event is received from the OBS WebSocket server. + /// + /// + /// The current scene transition has changed. + /// Requires the Transitions subscription. + /// Category: transitions | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? CurrentSceneTransitionChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnCurrentSceneTransitionChanged(ObsWebSocket.Core.Events.Generated.CurrentSceneTransitionChangedEventArgs e) + { + CurrentSceneTransitionChanged?.Invoke(this, e); + } + + /// + /// Occurs when the CurrentSceneTransitionDurationChanged event is received from the OBS WebSocket server. + /// + /// + /// The current scene transition duration has changed. + /// Requires the Transitions subscription. + /// Category: transitions | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? CurrentSceneTransitionDurationChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnCurrentSceneTransitionDurationChanged(ObsWebSocket.Core.Events.Generated.CurrentSceneTransitionDurationChangedEventArgs e) + { + CurrentSceneTransitionDurationChanged?.Invoke(this, e); + } + + /// + /// Occurs when the SceneTransitionStarted event is received from the OBS WebSocket server. + /// + /// + /// A scene transition has started. + /// Requires the Transitions subscription. + /// Category: transitions | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneTransitionStarted; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneTransitionStarted(ObsWebSocket.Core.Events.Generated.SceneTransitionStartedEventArgs e) + { + SceneTransitionStarted?.Invoke(this, e); + } + + /// + /// Occurs when the SceneTransitionEnded event is received from the OBS WebSocket server. + /// + /// + /// A scene transition has completed fully. + /// + /// Note: Does not appear to trigger when the transition is interrupted by the user. + /// Requires the Transitions subscription. + /// Category: transitions | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneTransitionEnded; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneTransitionEnded(ObsWebSocket.Core.Events.Generated.SceneTransitionEndedEventArgs e) + { + SceneTransitionEnded?.Invoke(this, e); + } + + /// + /// Occurs when the SceneTransitionVideoEnded event is received from the OBS WebSocket server. + /// + /// + /// A scene transition's video has completed fully. + /// + /// Useful for stinger transitions to tell when the video *actually* ends. + /// `SceneTransitionEnded` only signifies the cut point, not the completion of transition playback. + /// + /// Note: Appears to be called by every transition, regardless of relevance. + /// Requires the Transitions subscription. + /// Category: transitions | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? SceneTransitionVideoEnded; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnSceneTransitionVideoEnded(ObsWebSocket.Core.Events.Generated.SceneTransitionVideoEndedEventArgs e) + { + SceneTransitionVideoEnded?.Invoke(this, e); + } + + /// + /// Occurs when the StudioModeStateChanged event is received from the OBS WebSocket server. + /// + /// + /// Studio mode has been enabled or disabled. + /// Requires the Ui subscription. + /// Category: ui | Complexity: 1 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? StudioModeStateChanged; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnStudioModeStateChanged(ObsWebSocket.Core.Events.Generated.StudioModeStateChangedEventArgs e) + { + StudioModeStateChanged?.Invoke(this, e); + } + + /// + /// Occurs when the ScreenshotSaved event is received from the OBS WebSocket server. + /// + /// + /// A screenshot has been saved. + /// + /// Note: Triggered for the screenshot feature available in `Settings -> Hotkeys -> Screenshot Output` ONLY. + /// Applications using `Get/SaveSourceScreenshot` should implement a `CustomEvent` if this kind of inter-client + /// communication is desired. + /// Requires the Ui subscription. + /// Category: ui | Complexity: 2 + /// RPC Version: 1 | Initial Version: 5.1.0 + /// + public event EventHandler? ScreenshotSaved; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnScreenshotSaved(ObsWebSocket.Core.Events.Generated.ScreenshotSavedEventArgs e) + { + ScreenshotSaved?.Invoke(this, e); + } + + /// + /// Occurs when the VendorEvent event is received from the OBS WebSocket server. + /// + /// + /// An event has been emitted from a vendor. + /// + /// A vendor is a unique name registered by a third-party plugin or script, which allows for custom requests and events to be added to obs-websocket. + /// If a plugin or script implements vendor requests or events, documentation is expected to be provided with them. + /// Requires the Vendors subscription. + /// Category: general | Complexity: 3 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? VendorEvent; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnVendorEvent(ObsWebSocket.Core.Events.Generated.VendorEventEventArgs e) + { + VendorEvent?.Invoke(this, e); + } + + /// + /// Occurs when the CustomEvent event is received from the OBS WebSocket server. + /// + /// + /// Custom event emitted by `BroadcastCustomEvent`. + /// Requires the General subscription. + /// Category: general | Complexity: 1 + /// RPC Version: 1 | Initial Version: 5.0.0 + /// + public event EventHandler? CustomEvent; + + /// Invokes the event handler safely. + /// The containing event data. + private void OnCustomEvent(ObsWebSocket.Core.Events.Generated.CustomEventEventArgs e) + { + CustomEvent?.Invoke(this, e); + } +} diff --git a/ObsWebSocket.Core/Generated/Client/ObsWebSocketClient.Extensions.g.cs b/ObsWebSocket.Core/Generated/Client/ObsWebSocketClient.Extensions.g.cs new file mode 100644 index 0000000..82bb37f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Client/ObsWebSocketClient.Extensions.g.cs @@ -0,0 +1,3067 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using ObsWebSocket.Core; +using ObsWebSocket.Core.Protocol; +using ObsWebSocket.Core.Protocol.Requests; +using ObsWebSocket.Core.Protocol.Responses; +using ObsWebSocket.Core.Protocol.Common; + +namespace ObsWebSocket.Core; + +/// +/// Provides strongly-typed extension methods for the , +/// corresponding to the requests defined in the OBS WebSocket v5 protocol. +/// +public static partial class ObsWebSocketClientExtensions +{ + /// + /// Gets the value of a "slot" from the selected persistent data realm. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetPersistentDataAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetPersistentDataRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetPersistentData", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the value of a "slot" from the selected persistent data realm. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetPersistentDataAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetPersistentDataRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetPersistentData", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an array of all scene collections + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneCollectionListAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneCollectionList", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Switches to a scene collection. + /// + /// Note: This will block until the collection has finished changing. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetCurrentSceneCollectionAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneCollectionRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetCurrentSceneCollection", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new scene collection, switching to it in the process. + /// + /// Note: This will block until the collection has finished changing. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task CreateSceneCollectionAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.CreateSceneCollectionRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("CreateSceneCollection", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an array of all profiles + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetProfileListAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetProfileList", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Switches to a profile. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetCurrentProfileAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetCurrentProfileRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetCurrentProfile", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new profile, switching to it in the process + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task CreateProfileAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.CreateProfileRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("CreateProfile", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes a profile. If the current profile is chosen, it will change to a different profile first. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task RemoveProfileAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.RemoveProfileRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("RemoveProfile", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a parameter from the current profile's configuration. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetProfileParameterAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetProfileParameterRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetProfileParameter", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the value of a parameter in the current profile's configuration. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetProfileParameterAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetProfileParameterRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetProfileParameter", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the current video settings. + /// + /// Note: To get the true FPS value, divide the FPS numerator by the FPS denominator. Example: `60000/1001` + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetVideoSettingsAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetVideoSettings", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the current video settings. + /// + /// Note: Fields must be specified in pairs. For example, you cannot set only `baseWidth` without needing to specify `baseHeight`. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetVideoSettingsAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetVideoSettingsRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetVideoSettings", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the current stream service settings (stream destination). + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetStreamServiceSettingsAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetStreamServiceSettings", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the current stream service settings (stream destination). + /// + /// Note: Simple RTMP settings can be set with type `rtmp_custom` and the settings fields `server` and `key`. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetStreamServiceSettingsAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetStreamServiceSettingsRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetStreamServiceSettings", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the current directory that the record output is set to. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetRecordDirectoryAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetRecordDirectory", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the current directory that the record output writes files to. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: config + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.3.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetRecordDirectoryAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetRecordDirectoryRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetRecordDirectory", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an array of all available source filter kinds. + /// + /// Similar to `GetInputKindList` + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: filters + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.4.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSourceFilterKindListAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSourceFilterKindList", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an array of all of a source's filters. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: filters + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSourceFilterListAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSourceFilterListRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSourceFilterList", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the default settings for a filter kind. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: filters + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSourceFilterDefaultSettingsAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSourceFilterDefaultSettingsRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSourceFilterDefaultSettings", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new filter, adding it to the specified source. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: filters + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task CreateSourceFilterAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.CreateSourceFilterRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("CreateSourceFilter", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes a filter from a source. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: filters + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task RemoveSourceFilterAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.RemoveSourceFilterRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("RemoveSourceFilter", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the name of a source filter (rename). + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: filters + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetSourceFilterNameAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetSourceFilterNameRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetSourceFilterName", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the info for a specific source filter. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: filters + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSourceFilterAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSourceFilterRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSourceFilter", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the index position of a filter on a source. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: filters + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetSourceFilterIndexAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetSourceFilterIndexRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetSourceFilterIndex", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the settings of a source filter. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: filters + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetSourceFilterSettingsAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetSourceFilterSettingsRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetSourceFilterSettings", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the enable state of a source filter. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: filters + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetSourceFilterEnabledAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetSourceFilterEnabledRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetSourceFilterEnabled", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets data about the current plugin and RPC version. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: general + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetVersionAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetVersion", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets statistics about OBS, obs-websocket, and the current session. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: general + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetStatsAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetStats", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Broadcasts a `CustomEvent` to all WebSocket clients. Receivers are clients which are identified and subscribed. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: general + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task BroadcastCustomEventAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.BroadcastCustomEventRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("BroadcastCustomEvent", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Call a request registered to a vendor. + /// + /// A vendor is a unique name registered by a third-party plugin or script, which allows for custom requests and events to be added to obs-websocket. + /// If a plugin or script implements vendor requests or events, documentation is expected to be provided with them. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: general + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task CallVendorRequestAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.CallVendorRequestRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("CallVendorRequest", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an array of all hotkey names in OBS. + /// + /// Note: Hotkey functionality in obs-websocket comes as-is, and we do not guarantee support if things are broken. In 9/10 usages of hotkey requests, there exists a better, more reliable method via other requests. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: general + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetHotkeyListAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetHotkeyList", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Triggers a hotkey using its name. See `GetHotkeyList`. + /// + /// Note: Hotkey functionality in obs-websocket comes as-is, and we do not guarantee support if things are broken. In 9/10 usages of hotkey requests, there exists a better, more reliable method via other requests. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: general + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task TriggerHotkeyByNameAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.TriggerHotkeyByNameRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("TriggerHotkeyByName", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Triggers a hotkey using a sequence of keys. + /// + /// Note: Hotkey functionality in obs-websocket comes as-is, and we do not guarantee support if things are broken. In 9/10 usages of hotkey requests, there exists a better, more reliable method via other requests. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: general + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task TriggerHotkeyByKeySequenceAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.TriggerHotkeyByKeySequenceRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("TriggerHotkeyByKeySequence", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sleeps for a time duration or number of frames. Only available in request batches with types `SERIAL_REALTIME` or `SERIAL_FRAME`. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: general + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SleepAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SleepRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("Sleep", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an array of all inputs in OBS. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputListAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputListRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputList", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an array of all available input kinds in OBS. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputKindListAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputKindListRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputKindList", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the names of all special inputs. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSpecialInputsAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSpecialInputs", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new input, adding it as a scene item to the specified scene. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task CreateInputAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.CreateInputRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("CreateInput", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes an existing input. + /// + /// Note: Will immediately remove all associated scene items. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task RemoveInputAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.RemoveInputRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("RemoveInput", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the name of an input (rename). + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetInputNameAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetInputNameRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetInputName", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the default settings for an input kind. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputDefaultSettingsAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputDefaultSettingsRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputDefaultSettings", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the settings of an input. + /// + /// Note: Does not include defaults. To create the entire settings object, overlay `inputSettings` over the `defaultInputSettings` provided by `GetInputDefaultSettings`. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputSettingsAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputSettingsRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputSettings", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the settings of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetInputSettingsAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetInputSettingsRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetInputSettings", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the audio mute state of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputMuteAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputMuteRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputMute", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the audio mute state of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetInputMuteAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetInputMuteRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetInputMute", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Toggles the audio mute state of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task ToggleInputMuteAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.ToggleInputMuteRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("ToggleInputMute", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the current volume setting of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputVolumeAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputVolumeRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputVolume", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the volume setting of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetInputVolumeAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetInputVolumeRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetInputVolume", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the audio balance of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputAudioBalanceAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputAudioBalanceRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputAudioBalance", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the audio balance of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetInputAudioBalanceAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetInputAudioBalanceRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetInputAudioBalance", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the audio sync offset of an input. + /// + /// Note: The audio sync offset can be negative too! + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputAudioSyncOffsetAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputAudioSyncOffsetRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputAudioSyncOffset", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the audio sync offset of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetInputAudioSyncOffsetAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetInputAudioSyncOffsetRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetInputAudioSyncOffset", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the audio monitor type of an input. + /// + /// The available audio monitor types are: + /// + /// - `OBS_MONITORING_TYPE_NONE` + /// - `OBS_MONITORING_TYPE_MONITOR_ONLY` + /// - `OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT` + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputAudioMonitorTypeAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputAudioMonitorTypeRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputAudioMonitorType", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the audio monitor type of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetInputAudioMonitorTypeAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetInputAudioMonitorTypeRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetInputAudioMonitorType", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the enable state of all audio tracks of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputAudioTracksAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputAudioTracksRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputAudioTracks", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the enable state of audio tracks of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetInputAudioTracksAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetInputAudioTracksRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetInputAudioTracks", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the deinterlace mode of an input. + /// + /// Deinterlace Modes: + /// + /// - `OBS_DEINTERLACE_MODE_DISABLE` + /// - `OBS_DEINTERLACE_MODE_DISCARD` + /// - `OBS_DEINTERLACE_MODE_RETRO` + /// - `OBS_DEINTERLACE_MODE_BLEND` + /// - `OBS_DEINTERLACE_MODE_BLEND_2X` + /// - `OBS_DEINTERLACE_MODE_LINEAR` + /// - `OBS_DEINTERLACE_MODE_LINEAR_2X` + /// - `OBS_DEINTERLACE_MODE_YADIF` + /// - `OBS_DEINTERLACE_MODE_YADIF_2X` + /// + /// Note: Deinterlacing functionality is restricted to async inputs only. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.6.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputDeinterlaceModeAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputDeinterlaceModeRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputDeinterlaceMode", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the deinterlace mode of an input. + /// + /// Note: Deinterlacing functionality is restricted to async inputs only. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.6.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetInputDeinterlaceModeAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetInputDeinterlaceModeRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetInputDeinterlaceMode", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the deinterlace field order of an input. + /// + /// Deinterlace Field Orders: + /// + /// - `OBS_DEINTERLACE_FIELD_ORDER_TOP` + /// - `OBS_DEINTERLACE_FIELD_ORDER_BOTTOM` + /// + /// Note: Deinterlacing functionality is restricted to async inputs only. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.6.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputDeinterlaceFieldOrderAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputDeinterlaceFieldOrderRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputDeinterlaceFieldOrder", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the deinterlace field order of an input. + /// + /// Note: Deinterlacing functionality is restricted to async inputs only. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.6.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetInputDeinterlaceFieldOrderAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetInputDeinterlaceFieldOrderRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetInputDeinterlaceFieldOrder", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the items of a list property from an input's properties. + /// + /// Note: Use this in cases where an input provides a dynamic, selectable list of items. For example, display capture, where it provides a list of available displays. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetInputPropertiesListPropertyItemsAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetInputPropertiesListPropertyItemsRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetInputPropertiesListPropertyItems", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Presses a button in the properties of an input. + /// + /// Some known `propertyName` values are: + /// + /// - `refreshnocache` - Browser source reload button + /// + /// Note: Use this in cases where there is a button in the properties of an input that cannot be accessed in any other way. For example, browser sources, where there is a refresh button. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: inputs + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task PressInputPropertiesButtonAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.PressInputPropertiesButtonRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("PressInputPropertiesButton", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the status of a media input. + /// + /// Media States: + /// + /// - `OBS_MEDIA_STATE_NONE` + /// - `OBS_MEDIA_STATE_PLAYING` + /// - `OBS_MEDIA_STATE_OPENING` + /// - `OBS_MEDIA_STATE_BUFFERING` + /// - `OBS_MEDIA_STATE_PAUSED` + /// - `OBS_MEDIA_STATE_STOPPED` + /// - `OBS_MEDIA_STATE_ENDED` + /// - `OBS_MEDIA_STATE_ERROR` + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: media inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetMediaInputStatusAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetMediaInputStatusRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetMediaInputStatus", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the cursor position of a media input. + /// + /// This request does not perform bounds checking of the cursor position. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: media inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetMediaInputCursorAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetMediaInputCursorRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetMediaInputCursor", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Offsets the current cursor position of a media input by the specified value. + /// + /// This request does not perform bounds checking of the cursor position. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: media inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task OffsetMediaInputCursorAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.OffsetMediaInputCursorRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("OffsetMediaInputCursor", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Triggers an action on a media input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: media inputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task TriggerMediaInputActionAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.TriggerMediaInputActionRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("TriggerMediaInputAction", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the status of the virtualcam output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetVirtualCamStatusAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetVirtualCamStatus", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Toggles the state of the virtualcam output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task ToggleVirtualCamAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("ToggleVirtualCam", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts the virtualcam output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task StartVirtualCamAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("StartVirtualCam", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops the virtualcam output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task StopVirtualCamAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("StopVirtualCam", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the status of the replay buffer output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetReplayBufferStatusAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetReplayBufferStatus", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Toggles the state of the replay buffer output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task ToggleReplayBufferAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("ToggleReplayBuffer", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts the replay buffer output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task StartReplayBufferAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("StartReplayBuffer", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops the replay buffer output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task StopReplayBufferAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("StopReplayBuffer", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Saves the contents of the replay buffer output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SaveReplayBufferAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("SaveReplayBuffer", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the filename of the last replay buffer save file. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetLastReplayBufferReplayAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetLastReplayBufferReplay", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the list of available outputs. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetOutputListAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetOutputList", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the status of an output. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetOutputStatusAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetOutputStatusRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetOutputStatus", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Toggles the status of an output. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task ToggleOutputAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.ToggleOutputRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("ToggleOutput", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts an output. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task StartOutputAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.StartOutputRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("StartOutput", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops an output. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task StopOutputAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.StopOutputRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("StopOutput", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the settings of an output. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetOutputSettingsAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetOutputSettingsRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetOutputSettings", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the settings of an output. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: outputs + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetOutputSettingsAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetOutputSettingsRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetOutputSettings", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the status of the record output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: record + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetRecordStatusAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetRecordStatus", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Toggles the status of the record output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: record + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task ToggleRecordAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("ToggleRecord", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts the record output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: record + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task StartRecordAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("StartRecord", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops the record output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: record + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task StopRecordAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("StopRecord", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Toggles pause on the record output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: record + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task ToggleRecordPauseAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("ToggleRecordPause", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Pauses the record output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: record + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task PauseRecordAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("PauseRecord", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Resumes the record output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: record + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task ResumeRecordAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("ResumeRecord", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Splits the current file being recorded into a new file. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: record + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.5.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SplitRecordFileAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("SplitRecordFile", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds a new chapter marker to the file currently being recorded. + /// + /// Note: As of OBS 30.2.0, the only file format supporting this feature is Hybrid MP4. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: record + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.5.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task CreateRecordChapterAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.CreateRecordChapterRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("CreateRecordChapter", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a list of all scene items in a scene. + /// + /// Scenes only + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneItemListAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSceneItemListRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneItemList", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Basically GetSceneItemList, but for groups. + /// + /// Using groups at all in OBS is discouraged, as they are very broken under the hood. Please use nested scenes instead. + /// + /// Groups only + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetGroupSceneItemListAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetGroupSceneItemListRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetGroupSceneItemList", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Searches a scene for a source, and returns its id. + /// + /// Scenes and Groups + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneItemIdAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSceneItemIdRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneItemId", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the source associated with a scene item. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.4.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneItemSourceAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSceneItemSourceRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneItemSource", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new scene item using a source. + /// + /// Scenes only + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task CreateSceneItemAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.CreateSceneItemRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("CreateSceneItem", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes a scene item from a scene. + /// + /// Scenes only + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task RemoveSceneItemAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.RemoveSceneItemRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("RemoveSceneItem", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Duplicates a scene item, copying all transform and crop info. + /// + /// Scenes only + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task DuplicateSceneItemAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.DuplicateSceneItemRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("DuplicateSceneItem", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the transform and crop info of a scene item. + /// + /// Scenes and Groups + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneItemTransformAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSceneItemTransformRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneItemTransform", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the transform and crop info of a scene item. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetSceneItemTransformAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetSceneItemTransformRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetSceneItemTransform", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the enable state of a scene item. + /// + /// Scenes and Groups + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneItemEnabledAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSceneItemEnabledRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneItemEnabled", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the enable state of a scene item. + /// + /// Scenes and Groups + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetSceneItemEnabledAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetSceneItemEnabledRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetSceneItemEnabled", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the lock state of a scene item. + /// + /// Scenes and Groups + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneItemLockedAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSceneItemLockedRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneItemLocked", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the lock state of a scene item. + /// + /// Scenes and Group + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetSceneItemLockedAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetSceneItemLockedRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetSceneItemLocked", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the index position of a scene item in a scene. + /// + /// An index of 0 is at the bottom of the source list in the UI. + /// + /// Scenes and Groups + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneItemIndexAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSceneItemIndexRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneItemIndex", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the index position of a scene item in a scene. + /// + /// Scenes and Groups + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetSceneItemIndexAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetSceneItemIndexRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetSceneItemIndex", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the blend mode of a scene item. + /// + /// Blend modes: + /// + /// - `OBS_BLEND_NORMAL` + /// - `OBS_BLEND_ADDITIVE` + /// - `OBS_BLEND_SUBTRACT` + /// - `OBS_BLEND_SCREEN` + /// - `OBS_BLEND_MULTIPLY` + /// - `OBS_BLEND_LIGHTEN` + /// - `OBS_BLEND_DARKEN` + /// + /// Scenes and Groups + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneItemBlendModeAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSceneItemBlendModeRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneItemBlendMode", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the blend mode of a scene item. + /// + /// Scenes and Groups + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: scene items + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetSceneItemBlendModeAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetSceneItemBlendModeRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetSceneItemBlendMode", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an array of all scenes in OBS. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scenes + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneListAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneList", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an array of all groups in OBS. + /// + /// Groups in OBS are actually scenes, but renamed and modified. In obs-websocket, we treat them as scenes where we can. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scenes + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetGroupListAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetGroupList", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the current program scene. + /// + /// Note: This request is slated to have the `currentProgram`-prefixed fields removed from in an upcoming RPC version. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scenes + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetCurrentProgramSceneAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetCurrentProgramScene", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the current program scene. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: scenes + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetCurrentProgramSceneAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetCurrentProgramSceneRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetCurrentProgramScene", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the current preview scene. + /// + /// Only available when studio mode is enabled. + /// + /// Note: This request is slated to have the `currentPreview`-prefixed fields removed from in an upcoming RPC version. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scenes + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetCurrentPreviewSceneAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetCurrentPreviewScene", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the current preview scene. + /// + /// Only available when studio mode is enabled. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: scenes + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetCurrentPreviewSceneAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetCurrentPreviewSceneRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetCurrentPreviewScene", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new scene in OBS. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scenes + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task CreateSceneAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.CreateSceneRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("CreateScene", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes a scene from OBS. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: scenes + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task RemoveSceneAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.RemoveSceneRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("RemoveScene", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the name of a scene (rename). + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: scenes + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetSceneNameAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetSceneNameRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetSceneName", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the scene transition overridden for a scene. + /// + /// Note: A transition UUID response field is not currently able to be implemented as of 2024-1-18. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: scenes + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneSceneTransitionOverrideAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSceneSceneTransitionOverrideRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneSceneTransitionOverride", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the scene transition overridden for a scene. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: scenes + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetSceneSceneTransitionOverrideAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetSceneSceneTransitionOverrideRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetSceneSceneTransitionOverride", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the active and show state of a source. + /// + /// **Compatible with inputs and scenes.** + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: sources + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSourceActiveAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSourceActiveRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSourceActive", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Base64-encoded screenshot of a source. + /// + /// The `imageWidth` and `imageHeight` parameters are treated as "scale to inner", meaning the smallest ratio will be used and the aspect ratio of the original resolution is kept. + /// If `imageWidth` and `imageHeight` are not specified, the compressed image will use the full resolution of the source. + /// + /// **Compatible with inputs and scenes.** + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: sources + /// Complexity Rating: 4/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSourceScreenshotAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.GetSourceScreenshotRequestData requestData, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSourceScreenshot", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Saves a screenshot of a source to the filesystem. + /// + /// The `imageWidth` and `imageHeight` parameters are treated as "scale to inner", meaning the smallest ratio will be used and the aspect ratio of the original resolution is kept. + /// If `imageWidth` and `imageHeight` are not specified, the compressed image will use the full resolution of the source. + /// + /// **Compatible with inputs and scenes.** + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: sources + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SaveSourceScreenshotAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SaveSourceScreenshotRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SaveSourceScreenshot", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the status of the stream output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: stream + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetStreamStatusAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetStreamStatus", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Toggles the status of the stream output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: stream + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task ToggleStreamAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("ToggleStream", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts the stream output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: stream + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task StartStreamAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("StartStream", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops the stream output. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: stream + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task StopStreamAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("StopStream", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sends CEA-608 caption text over the stream output. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: stream + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SendStreamCaptionAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SendStreamCaptionRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SendStreamCaption", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an array of all available transition kinds. + /// + /// Similar to `GetInputKindList` + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: transitions + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetTransitionKindListAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetTransitionKindList", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an array of all scene transitions in OBS. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: transitions + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetSceneTransitionListAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetSceneTransitionList", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the current scene transition. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: transitions + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetCurrentSceneTransitionAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetCurrentSceneTransition", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the current scene transition. + /// + /// Small note: While the namespace of scene transitions is generally unique, that uniqueness is not a guarantee as it is with other resources like inputs. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: transitions + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetCurrentSceneTransitionAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneTransitionRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetCurrentSceneTransition", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the duration of the current scene transition, if it is not fixed. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: transitions + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetCurrentSceneTransitionDurationAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneTransitionDurationRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetCurrentSceneTransitionDuration", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the settings of the current scene transition. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: transitions + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetCurrentSceneTransitionSettingsAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneTransitionSettingsRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetCurrentSceneTransitionSettings", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the cursor position of the current scene transition. + /// + /// Note: `transitionCursor` will return 1.0 when the transition is inactive. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: transitions + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetCurrentSceneTransitionCursorAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetCurrentSceneTransitionCursor", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Triggers the current scene transition. Same functionality as the `Transition` button in studio mode. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: transitions + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task TriggerStudioModeTransitionAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + await client.CallAsync("TriggerStudioModeTransition", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Sets the position of the TBar. + /// + /// **Very important note**: This will be deprecated and replaced in a future version of obs-websocket. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: transitions + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetTBarPositionAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetTBarPositionRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetTBarPosition", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets whether studio is enabled. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: ui + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetStudioModeEnabledAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetStudioModeEnabled", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Enables or disables studio mode + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: ui + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task SetStudioModeEnabledAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.SetStudioModeEnabledRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("SetStudioModeEnabled", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Opens the properties dialog of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: ui + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task OpenInputPropertiesDialogAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.OpenInputPropertiesDialogRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("OpenInputPropertiesDialog", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Opens the filters dialog of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: ui + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task OpenInputFiltersDialogAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.OpenInputFiltersDialogRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("OpenInputFiltersDialog", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Opens the interact dialog of an input. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: ui + /// Complexity Rating: 1/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task OpenInputInteractDialogAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.OpenInputInteractDialogRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("OpenInputInteractDialog", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a list of connected monitors and information about them. + /// + /// The instance. + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Yields the response data, or null if the successful response does not contain data. + /// + /// OBS WebSocket Protocol Category: ui + /// Complexity Rating: 2/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task GetMonitorListAsync(this ObsWebSocketClient client, CancellationToken cancellationToken = default) + { + return await client.CallAsync("GetMonitorList", null, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Opens a projector for a specific output video mix. + /// + /// Mix types: + /// + /// - `OBS_WEBSOCKET_VIDEO_MIX_TYPE_PREVIEW` + /// - `OBS_WEBSOCKET_VIDEO_MIX_TYPE_PROGRAM` + /// - `OBS_WEBSOCKET_VIDEO_MIX_TYPE_MULTIVIEW` + /// + /// Note: This request serves to provide feature parity with 4.x. It is very likely to be changed/deprecated in a future release. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: ui + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task OpenVideoMixProjectorAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.OpenVideoMixProjectorRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("OpenVideoMixProjector", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Opens a projector for a source. + /// + /// Note: This request serves to provide feature parity with 4.x. It is very likely to be changed/deprecated in a future release. + /// + /// The instance. + /// The data required for the request (). + /// A token to cancel the asynchronous operation. + /// A task representing the asynchronous operation. Completes when the request is processed successfully by the server. + /// + /// OBS WebSocket Protocol Category: ui + /// Complexity Rating: 3/5 + /// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 + /// Generated from obs-websocket protocol definition. + /// Thrown if the request fails on the OBS side. + /// Thrown if the client is not connected. + /// Thrown if cancelled. + public static async Task OpenSourceProjectorAsync(this ObsWebSocketClient client, ObsWebSocket.Core.Protocol.Requests.OpenSourceProjectorRequestData requestData, CancellationToken cancellationToken = default) + { + await client.CallAsync("OpenSourceProjector", requestData, cancellationToken: cancellationToken).ConfigureAwait(false); + } + +} diff --git a/ObsWebSocket.Core/Generated/Client/ObsWebSocketClient.WaitForEvent.g.cs b/ObsWebSocket.Core/Generated/Client/ObsWebSocketClient.WaitForEvent.g.cs new file mode 100644 index 0000000..c926145 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Client/ObsWebSocketClient.WaitForEvent.g.cs @@ -0,0 +1,1275 @@ +// +// Helper: WaitForEventAsync +#nullable enable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using ObsWebSocket.Core; +using ObsWebSocket.Core.Events; +using ObsWebSocket.Core.Events.Generated; + +namespace ObsWebSocket.Core; // Add to ObsWebSocket.Core namespace + +/// +/// Contains generated helper methods for the . +/// +public static partial class ObsWebSocketClientHelpers +{ + /// + /// Asynchronously waits for a specific OBS event of type that satisfies a predicate condition. + /// + /// The specific type of to wait for. + /// The instance. + /// A function to test each received event of the specified type for a condition. + /// The maximum time to wait for the event. + /// A token to cancel the wait operation externally. + /// + /// A task representing the asynchronous operation. The task result contains the instance + /// that satisfied the predicate, or null if the timeout occurred or the operation was canceled. + /// + /// + /// This method subscribes temporarily to the corresponding event on the client, waits for a matching event or timeout/cancellation, + /// and then automatically unsubscribes. It ensures that the subscription happens *before* the method returns, + /// making it suitable for 'subscribe-then-act' patterns to avoid race conditions. + /// This helper is generated based on the OBS WebSocket protocol definition and avoids runtime reflection. + /// + /// Thrown if client or predicate is null. + /// Thrown if the client is not connected. + /// Thrown if waiting for the specified type is not supported (e.g., no corresponding event found in the protocol). + public static async Task WaitForEventAsync( + this ObsWebSocketClient client, + Func predicate, + TimeSpan timeout, + CancellationToken cancellationToken = default) where TEventArgs : ObsEventArgs + { + ArgumentNullException.ThrowIfNull(client); + ArgumentNullException.ThrowIfNull(predicate); + + client.EnsureConnected(); // Checks if connection is active + + // Use RunContinuationsAsynchronously to avoid potential deadlocks if predicate runs synchronously + TaskCompletionSource tcs = new(TaskCreationOptions.RunContinuationsAsynchronously); + // Link the external token with our internal timeout token + using var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); + linkedCts.CancelAfter(timeout); // Apply timeout + + Action? unsubscribeAction = null; // Delegate to hold the unsubscribe logic + + try + { + // This switch is generated based on known events with data from protocol.json + switch (typeof(TEventArgs)) + { + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.CurrentSceneCollectionChangingEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.CurrentSceneCollectionChanging += specificHandler; + unsubscribeAction = () => client.CurrentSceneCollectionChanging -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.CurrentSceneCollectionChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.CurrentSceneCollectionChanged += specificHandler; + unsubscribeAction = () => client.CurrentSceneCollectionChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneCollectionListChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneCollectionListChanged += specificHandler; + unsubscribeAction = () => client.SceneCollectionListChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.CurrentProfileChangingEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.CurrentProfileChanging += specificHandler; + unsubscribeAction = () => client.CurrentProfileChanging -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.CurrentProfileChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.CurrentProfileChanged += specificHandler; + unsubscribeAction = () => client.CurrentProfileChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.ProfileListChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.ProfileListChanged += specificHandler; + unsubscribeAction = () => client.ProfileListChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SourceFilterListReindexedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SourceFilterListReindexed += specificHandler; + unsubscribeAction = () => client.SourceFilterListReindexed -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SourceFilterCreatedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SourceFilterCreated += specificHandler; + unsubscribeAction = () => client.SourceFilterCreated -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SourceFilterRemovedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SourceFilterRemoved += specificHandler; + unsubscribeAction = () => client.SourceFilterRemoved -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SourceFilterNameChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SourceFilterNameChanged += specificHandler; + unsubscribeAction = () => client.SourceFilterNameChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SourceFilterSettingsChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SourceFilterSettingsChanged += specificHandler; + unsubscribeAction = () => client.SourceFilterSettingsChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SourceFilterEnableStateChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SourceFilterEnableStateChanged += specificHandler; + unsubscribeAction = () => client.SourceFilterEnableStateChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputCreatedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputCreated += specificHandler; + unsubscribeAction = () => client.InputCreated -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputRemovedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputRemoved += specificHandler; + unsubscribeAction = () => client.InputRemoved -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputNameChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputNameChanged += specificHandler; + unsubscribeAction = () => client.InputNameChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputSettingsChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputSettingsChanged += specificHandler; + unsubscribeAction = () => client.InputSettingsChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputActiveStateChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputActiveStateChanged += specificHandler; + unsubscribeAction = () => client.InputActiveStateChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputShowStateChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputShowStateChanged += specificHandler; + unsubscribeAction = () => client.InputShowStateChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputMuteStateChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputMuteStateChanged += specificHandler; + unsubscribeAction = () => client.InputMuteStateChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputVolumeChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputVolumeChanged += specificHandler; + unsubscribeAction = () => client.InputVolumeChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputAudioBalanceChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputAudioBalanceChanged += specificHandler; + unsubscribeAction = () => client.InputAudioBalanceChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputAudioSyncOffsetChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputAudioSyncOffsetChanged += specificHandler; + unsubscribeAction = () => client.InputAudioSyncOffsetChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputAudioTracksChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputAudioTracksChanged += specificHandler; + unsubscribeAction = () => client.InputAudioTracksChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputAudioMonitorTypeChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputAudioMonitorTypeChanged += specificHandler; + unsubscribeAction = () => client.InputAudioMonitorTypeChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.InputVolumeMetersEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.InputVolumeMeters += specificHandler; + unsubscribeAction = () => client.InputVolumeMeters -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.MediaInputPlaybackStartedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.MediaInputPlaybackStarted += specificHandler; + unsubscribeAction = () => client.MediaInputPlaybackStarted -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.MediaInputPlaybackEndedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.MediaInputPlaybackEnded += specificHandler; + unsubscribeAction = () => client.MediaInputPlaybackEnded -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.MediaInputActionTriggeredEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.MediaInputActionTriggered += specificHandler; + unsubscribeAction = () => client.MediaInputActionTriggered -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.StreamStateChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.StreamStateChanged += specificHandler; + unsubscribeAction = () => client.StreamStateChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.RecordStateChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.RecordStateChanged += specificHandler; + unsubscribeAction = () => client.RecordStateChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.RecordFileChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.RecordFileChanged += specificHandler; + unsubscribeAction = () => client.RecordFileChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.ReplayBufferStateChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.ReplayBufferStateChanged += specificHandler; + unsubscribeAction = () => client.ReplayBufferStateChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.VirtualcamStateChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.VirtualcamStateChanged += specificHandler; + unsubscribeAction = () => client.VirtualcamStateChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.ReplayBufferSavedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.ReplayBufferSaved += specificHandler; + unsubscribeAction = () => client.ReplayBufferSaved -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneItemCreatedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneItemCreated += specificHandler; + unsubscribeAction = () => client.SceneItemCreated -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneItemRemovedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneItemRemoved += specificHandler; + unsubscribeAction = () => client.SceneItemRemoved -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneItemListReindexedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneItemListReindexed += specificHandler; + unsubscribeAction = () => client.SceneItemListReindexed -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneItemEnableStateChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneItemEnableStateChanged += specificHandler; + unsubscribeAction = () => client.SceneItemEnableStateChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneItemLockStateChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneItemLockStateChanged += specificHandler; + unsubscribeAction = () => client.SceneItemLockStateChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneItemSelectedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneItemSelected += specificHandler; + unsubscribeAction = () => client.SceneItemSelected -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneItemTransformChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneItemTransformChanged += specificHandler; + unsubscribeAction = () => client.SceneItemTransformChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneCreatedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneCreated += specificHandler; + unsubscribeAction = () => client.SceneCreated -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneRemovedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneRemoved += specificHandler; + unsubscribeAction = () => client.SceneRemoved -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneNameChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneNameChanged += specificHandler; + unsubscribeAction = () => client.SceneNameChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.CurrentProgramSceneChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.CurrentProgramSceneChanged += specificHandler; + unsubscribeAction = () => client.CurrentProgramSceneChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.CurrentPreviewSceneChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.CurrentPreviewSceneChanged += specificHandler; + unsubscribeAction = () => client.CurrentPreviewSceneChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneListChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneListChanged += specificHandler; + unsubscribeAction = () => client.SceneListChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.CurrentSceneTransitionChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.CurrentSceneTransitionChanged += specificHandler; + unsubscribeAction = () => client.CurrentSceneTransitionChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.CurrentSceneTransitionDurationChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.CurrentSceneTransitionDurationChanged += specificHandler; + unsubscribeAction = () => client.CurrentSceneTransitionDurationChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneTransitionStartedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneTransitionStarted += specificHandler; + unsubscribeAction = () => client.SceneTransitionStarted -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneTransitionEndedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneTransitionEnded += specificHandler; + unsubscribeAction = () => client.SceneTransitionEnded -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.SceneTransitionVideoEndedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.SceneTransitionVideoEnded += specificHandler; + unsubscribeAction = () => client.SceneTransitionVideoEnded -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.StudioModeStateChangedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.StudioModeStateChanged += specificHandler; + unsubscribeAction = () => client.StudioModeStateChanged -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.ScreenshotSavedEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.ScreenshotSaved += specificHandler; + unsubscribeAction = () => client.ScreenshotSaved -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.VendorEventEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.VendorEvent += specificHandler; + unsubscribeAction = () => client.VendorEvent -= specificHandler; + break; + } + case Type t when t == typeof(ObsWebSocket.Core.Events.Generated.CustomEventEventArgs): + { + EventHandler specificHandler = (sender, e) => + { + try + { + if (predicate((TEventArgs)(object)e)) + { + tcs.TrySetResult((TEventArgs?)(object?)e); + } + } + catch (Exception ex) + { + // Catch exceptions from user predicate and fail the task + tcs.TrySetException(ex); + } + }; + client.CustomEvent += specificHandler; + unsubscribeAction = () => client.CustomEvent -= specificHandler; + break; + } + default: + throw new NotSupportedException($"Waiting for event type '{typeof(TEventArgs).FullName}' is not supported by the generated WaitForEventAsync. Check if it's a valid event args type derived from ObsEventArgs and corresponds to an event with data fields in the protocol."); + } + + // Wait for the TaskCompletionSource to be set by the event handler or for cancellation/timeout + await tcs.Task.WaitAsync(linkedCts.Token).ConfigureAwait(false); + // Retrieve the result. If WaitAsync threw OperationCanceledException, this won't be reached. + // If the TCS was set with an exception (e.g., from predicate), awaiting here will rethrow it. + return await tcs.Task; + } + catch (OperationCanceledException) when (linkedCts.IsCancellationRequested) + { + // Timeout occurred or external cancellation token was triggered + // Log level Debug is appropriate as timeout/cancellation can be expected conditions + client._logger.LogDebug("WaitForEventAsync<{EventType}> timed out or was canceled.", typeof(TEventArgs).Name); + // Ensure the TaskCompletionSource reflects the cancellation + tcs.TrySetCanceled(linkedCts.Token); + return null; // Return null as per method contract for timeout/cancellation + } + catch (Exception ex) + { + // Catch exceptions from predicate execution propagated via tcs.TrySetException or other unexpected errors + client._logger.LogError(ex, "Exception occurred during WaitForEventAsync<{EventType}> predicate evaluation or waiting.", typeof(TEventArgs).Name); + // Ensure the TaskCompletionSource reflects the error if it wasn't already set + tcs.TrySetException(ex); + throw; // Re-throw the exception to the caller + } + finally + { + // Crucial: Always attempt to unsubscribe the temporary handler + // This prevents memory leaks if the method completes or throws. + unsubscribeAction?.Invoke(); + } + } +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/CurrentPreviewSceneChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/CurrentPreviewSceneChangedEventArgs.g.cs new file mode 100644 index 0000000..57a4da1 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/CurrentPreviewSceneChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>CurrentPreviewSceneChanged</c> event. +/// +/// +/// The current preview scene has changed. +/// Requires Subscription: Scenes | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class CurrentPreviewSceneChangedEventArgs(CurrentPreviewSceneChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/CurrentProfileChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/CurrentProfileChangedEventArgs.g.cs new file mode 100644 index 0000000..ab84297 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/CurrentProfileChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>CurrentProfileChanged</c> event. +/// +/// +/// The current profile has changed. +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class CurrentProfileChangedEventArgs(CurrentProfileChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/CurrentProfileChangingEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/CurrentProfileChangingEventArgs.g.cs new file mode 100644 index 0000000..1075366 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/CurrentProfileChangingEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>CurrentProfileChanging</c> event. +/// +/// +/// The current profile has begun changing. +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class CurrentProfileChangingEventArgs(CurrentProfileChangingPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/CurrentProgramSceneChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/CurrentProgramSceneChangedEventArgs.g.cs new file mode 100644 index 0000000..d444188 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/CurrentProgramSceneChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>CurrentProgramSceneChanged</c> event. +/// +/// +/// The current program scene has changed. +/// Requires Subscription: Scenes | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class CurrentProgramSceneChangedEventArgs(CurrentProgramSceneChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneCollectionChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneCollectionChangedEventArgs.g.cs new file mode 100644 index 0000000..684f9cc --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneCollectionChangedEventArgs.g.cs @@ -0,0 +1,22 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>CurrentSceneCollectionChanged</c> event. +/// +/// +/// The current scene collection has changed. +/// +/// Note: If polling has been paused during `CurrentSceneCollectionChanging`, this is the que to restart polling. +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class CurrentSceneCollectionChangedEventArgs(CurrentSceneCollectionChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneCollectionChangingEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneCollectionChangingEventArgs.g.cs new file mode 100644 index 0000000..f2e7c40 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneCollectionChangingEventArgs.g.cs @@ -0,0 +1,23 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>CurrentSceneCollectionChanging</c> event. +/// +/// +/// The current scene collection has begun changing. +/// +/// Note: We recommend using this event to trigger a pause of all polling requests, as performing any requests during a +/// scene collection change is considered undefined behavior and can cause crashes! +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class CurrentSceneCollectionChangingEventArgs(CurrentSceneCollectionChangingPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneTransitionChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneTransitionChangedEventArgs.g.cs new file mode 100644 index 0000000..685f011 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneTransitionChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>CurrentSceneTransitionChanged</c> event. +/// +/// +/// The current scene transition has changed. +/// Requires Subscription: Transitions | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class CurrentSceneTransitionChangedEventArgs(CurrentSceneTransitionChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneTransitionDurationChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneTransitionDurationChangedEventArgs.g.cs new file mode 100644 index 0000000..8bdb8b6 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/CurrentSceneTransitionDurationChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>CurrentSceneTransitionDurationChanged</c> event. +/// +/// +/// The current scene transition duration has changed. +/// Requires Subscription: Transitions | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class CurrentSceneTransitionDurationChangedEventArgs(CurrentSceneTransitionDurationChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/CustomEventEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/CustomEventEventArgs.g.cs new file mode 100644 index 0000000..cb3983a --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/CustomEventEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>CustomEvent</c> event. +/// +/// +/// Custom event emitted by `BroadcastCustomEvent`. +/// Requires Subscription: General | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class CustomEventEventArgs(CustomEventPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/ExitStartedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/ExitStartedEventArgs.g.cs new file mode 100644 index 0000000..0550415 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/ExitStartedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>ExitStarted</c> event. +/// +/// +/// OBS has begun the shutdown process. +/// Requires Subscription: General | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +public sealed partial class ExitStartedEventArgs : ObsEventArgs +{ + /// Initializes a new instance of the class. + public ExitStartedEventArgs() { } +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputActiveStateChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputActiveStateChangedEventArgs.g.cs new file mode 100644 index 0000000..3296696 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputActiveStateChangedEventArgs.g.cs @@ -0,0 +1,22 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputActiveStateChanged</c> event. +/// +/// +/// An input's active state has changed. +/// +/// When an input is active, it means it's being shown by the program feed. +/// Requires Subscription: InputActiveStateChanged | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputActiveStateChangedEventArgs(InputActiveStateChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputAudioBalanceChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputAudioBalanceChangedEventArgs.g.cs new file mode 100644 index 0000000..a0246d0 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputAudioBalanceChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputAudioBalanceChanged</c> event. +/// +/// +/// The audio balance value of an input has changed. +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputAudioBalanceChangedEventArgs(InputAudioBalanceChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputAudioMonitorTypeChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputAudioMonitorTypeChangedEventArgs.g.cs new file mode 100644 index 0000000..d6c619e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputAudioMonitorTypeChangedEventArgs.g.cs @@ -0,0 +1,26 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputAudioMonitorTypeChanged</c> event. +/// +/// +/// The monitor type of an input has changed. +/// +/// Available types are: +/// +/// - `OBS_MONITORING_TYPE_NONE` +/// - `OBS_MONITORING_TYPE_MONITOR_ONLY` +/// - `OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT` +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputAudioMonitorTypeChangedEventArgs(InputAudioMonitorTypeChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputAudioSyncOffsetChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputAudioSyncOffsetChangedEventArgs.g.cs new file mode 100644 index 0000000..2510d26 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputAudioSyncOffsetChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputAudioSyncOffsetChanged</c> event. +/// +/// +/// The sync offset of an input has changed. +/// Requires Subscription: Inputs | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputAudioSyncOffsetChangedEventArgs(InputAudioSyncOffsetChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputAudioTracksChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputAudioTracksChangedEventArgs.g.cs new file mode 100644 index 0000000..2161308 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputAudioTracksChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputAudioTracksChanged</c> event. +/// +/// +/// The audio tracks of an input have changed. +/// Requires Subscription: Inputs | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputAudioTracksChangedEventArgs(InputAudioTracksChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputCreatedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputCreatedEventArgs.g.cs new file mode 100644 index 0000000..328034f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputCreatedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputCreated</c> event. +/// +/// +/// An input has been created. +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputCreatedEventArgs(InputCreatedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputMuteStateChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputMuteStateChangedEventArgs.g.cs new file mode 100644 index 0000000..e3f3a94 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputMuteStateChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputMuteStateChanged</c> event. +/// +/// +/// An input's mute state has changed. +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputMuteStateChangedEventArgs(InputMuteStateChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputNameChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputNameChangedEventArgs.g.cs new file mode 100644 index 0000000..39eaf36 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputNameChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputNameChanged</c> event. +/// +/// +/// The name of an input has changed. +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputNameChangedEventArgs(InputNameChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputRemovedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputRemovedEventArgs.g.cs new file mode 100644 index 0000000..c4f1402 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputRemovedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputRemoved</c> event. +/// +/// +/// An input has been removed. +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputRemovedEventArgs(InputRemovedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputSettingsChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputSettingsChangedEventArgs.g.cs new file mode 100644 index 0000000..451d773 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputSettingsChangedEventArgs.g.cs @@ -0,0 +1,22 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputSettingsChanged</c> event. +/// +/// +/// An input's settings have changed (been updated). +/// +/// Note: On some inputs, changing values in the properties dialog will cause an immediate update. Pressing the "Cancel" button will revert the settings, resulting in another event being fired. +/// Requires Subscription: Inputs | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.4.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputSettingsChangedEventArgs(InputSettingsChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputShowStateChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputShowStateChangedEventArgs.g.cs new file mode 100644 index 0000000..585267f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputShowStateChangedEventArgs.g.cs @@ -0,0 +1,22 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputShowStateChanged</c> event. +/// +/// +/// An input's show state has changed. +/// +/// When an input is showing, it means it's being shown by the preview or a dialog. +/// Requires Subscription: InputShowStateChanged | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputShowStateChangedEventArgs(InputShowStateChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputVolumeChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputVolumeChangedEventArgs.g.cs new file mode 100644 index 0000000..0b10908 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputVolumeChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputVolumeChanged</c> event. +/// +/// +/// An input's volume level has changed. +/// Requires Subscription: Inputs | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputVolumeChangedEventArgs(InputVolumeChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/InputVolumeMetersEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/InputVolumeMetersEventArgs.g.cs new file mode 100644 index 0000000..097dbbd --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/InputVolumeMetersEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>InputVolumeMeters</c> event. +/// +/// +/// A high-volume event providing volume levels of all active inputs every 50 milliseconds. +/// Requires Subscription: InputVolumeMeters | Complexity: 4 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class InputVolumeMetersEventArgs(InputVolumeMetersPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/MediaInputActionTriggeredEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/MediaInputActionTriggeredEventArgs.g.cs new file mode 100644 index 0000000..8ccba8c --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/MediaInputActionTriggeredEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>MediaInputActionTriggered</c> event. +/// +/// +/// An action has been performed on an input. +/// Requires Subscription: MediaInputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class MediaInputActionTriggeredEventArgs(MediaInputActionTriggeredPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/MediaInputPlaybackEndedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/MediaInputPlaybackEndedEventArgs.g.cs new file mode 100644 index 0000000..16604a7 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/MediaInputPlaybackEndedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>MediaInputPlaybackEnded</c> event. +/// +/// +/// A media input has finished playing. +/// Requires Subscription: MediaInputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class MediaInputPlaybackEndedEventArgs(MediaInputPlaybackEndedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/MediaInputPlaybackStartedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/MediaInputPlaybackStartedEventArgs.g.cs new file mode 100644 index 0000000..080fb5c --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/MediaInputPlaybackStartedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>MediaInputPlaybackStarted</c> event. +/// +/// +/// A media input has started playing. +/// Requires Subscription: MediaInputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class MediaInputPlaybackStartedEventArgs(MediaInputPlaybackStartedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/ProfileListChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/ProfileListChangedEventArgs.g.cs new file mode 100644 index 0000000..d62c749 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/ProfileListChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>ProfileListChanged</c> event. +/// +/// +/// The profile list has changed. +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class ProfileListChangedEventArgs(ProfileListChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/RecordFileChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/RecordFileChangedEventArgs.g.cs new file mode 100644 index 0000000..74604cb --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/RecordFileChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>RecordFileChanged</c> event. +/// +/// +/// The record output has started writing to a new file. For example, when a file split happens. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.5.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class RecordFileChangedEventArgs(RecordFileChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/RecordStateChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/RecordStateChangedEventArgs.g.cs new file mode 100644 index 0000000..8a13650 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/RecordStateChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>RecordStateChanged</c> event. +/// +/// +/// The state of the record output has changed. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class RecordStateChangedEventArgs(RecordStateChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/ReplayBufferSavedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/ReplayBufferSavedEventArgs.g.cs new file mode 100644 index 0000000..ea93e69 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/ReplayBufferSavedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>ReplayBufferSaved</c> event. +/// +/// +/// The replay buffer has been saved. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class ReplayBufferSavedEventArgs(ReplayBufferSavedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/ReplayBufferStateChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/ReplayBufferStateChangedEventArgs.g.cs new file mode 100644 index 0000000..2b72bd9 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/ReplayBufferStateChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>ReplayBufferStateChanged</c> event. +/// +/// +/// The state of the replay buffer output has changed. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class ReplayBufferStateChangedEventArgs(ReplayBufferStateChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneCollectionListChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneCollectionListChangedEventArgs.g.cs new file mode 100644 index 0000000..16e6147 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneCollectionListChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneCollectionListChanged</c> event. +/// +/// +/// The scene collection list has changed. +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneCollectionListChangedEventArgs(SceneCollectionListChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneCreatedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneCreatedEventArgs.g.cs new file mode 100644 index 0000000..73dc4fc --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneCreatedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneCreated</c> event. +/// +/// +/// A new scene has been created. +/// Requires Subscription: Scenes | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneCreatedEventArgs(SceneCreatedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneItemCreatedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemCreatedEventArgs.g.cs new file mode 100644 index 0000000..80595cd --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemCreatedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneItemCreated</c> event. +/// +/// +/// A scene item has been created. +/// Requires Subscription: SceneItems | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneItemCreatedEventArgs(SceneItemCreatedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneItemEnableStateChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemEnableStateChangedEventArgs.g.cs new file mode 100644 index 0000000..d0d9001 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemEnableStateChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneItemEnableStateChanged</c> event. +/// +/// +/// A scene item's enable state has changed. +/// Requires Subscription: SceneItems | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneItemEnableStateChangedEventArgs(SceneItemEnableStateChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneItemListReindexedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemListReindexedEventArgs.g.cs new file mode 100644 index 0000000..5281c9e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemListReindexedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneItemListReindexed</c> event. +/// +/// +/// A scene's item list has been reindexed. +/// Requires Subscription: SceneItems | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneItemListReindexedEventArgs(SceneItemListReindexedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneItemLockStateChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemLockStateChangedEventArgs.g.cs new file mode 100644 index 0000000..6f8d227 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemLockStateChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneItemLockStateChanged</c> event. +/// +/// +/// A scene item's lock state has changed. +/// Requires Subscription: SceneItems | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneItemLockStateChangedEventArgs(SceneItemLockStateChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneItemRemovedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemRemovedEventArgs.g.cs new file mode 100644 index 0000000..bd37dc2 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemRemovedEventArgs.g.cs @@ -0,0 +1,22 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneItemRemoved</c> event. +/// +/// +/// A scene item has been removed. +/// +/// This event is not emitted when the scene the item is in is removed. +/// Requires Subscription: SceneItems | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneItemRemovedEventArgs(SceneItemRemovedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneItemSelectedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemSelectedEventArgs.g.cs new file mode 100644 index 0000000..cc49256 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemSelectedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneItemSelected</c> event. +/// +/// +/// A scene item has been selected in the Ui. +/// Requires Subscription: SceneItems | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneItemSelectedEventArgs(SceneItemSelectedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneItemTransformChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemTransformChangedEventArgs.g.cs new file mode 100644 index 0000000..de742b6 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneItemTransformChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneItemTransformChanged</c> event. +/// +/// +/// The transform/crop of a scene item has changed. +/// Requires Subscription: SceneItemTransformChanged | Complexity: 4 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneItemTransformChangedEventArgs(SceneItemTransformChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneListChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneListChangedEventArgs.g.cs new file mode 100644 index 0000000..720e02d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneListChangedEventArgs.g.cs @@ -0,0 +1,22 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneListChanged</c> event. +/// +/// +/// The list of scenes has changed. +/// +/// TODO: Make OBS fire this event when scenes are reordered. +/// Requires Subscription: Scenes | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneListChangedEventArgs(SceneListChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneNameChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneNameChangedEventArgs.g.cs new file mode 100644 index 0000000..94fef7e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneNameChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneNameChanged</c> event. +/// +/// +/// The name of a scene has changed. +/// Requires Subscription: Scenes | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneNameChangedEventArgs(SceneNameChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneRemovedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneRemovedEventArgs.g.cs new file mode 100644 index 0000000..eec1ab6 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneRemovedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneRemoved</c> event. +/// +/// +/// A scene has been removed. +/// Requires Subscription: Scenes | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneRemovedEventArgs(SceneRemovedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneTransitionEndedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneTransitionEndedEventArgs.g.cs new file mode 100644 index 0000000..af0a875 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneTransitionEndedEventArgs.g.cs @@ -0,0 +1,22 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneTransitionEnded</c> event. +/// +/// +/// A scene transition has completed fully. +/// +/// Note: Does not appear to trigger when the transition is interrupted by the user. +/// Requires Subscription: Transitions | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneTransitionEndedEventArgs(SceneTransitionEndedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneTransitionStartedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneTransitionStartedEventArgs.g.cs new file mode 100644 index 0000000..e329b77 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneTransitionStartedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneTransitionStarted</c> event. +/// +/// +/// A scene transition has started. +/// Requires Subscription: Transitions | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneTransitionStartedEventArgs(SceneTransitionStartedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SceneTransitionVideoEndedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SceneTransitionVideoEndedEventArgs.g.cs new file mode 100644 index 0000000..3829053 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SceneTransitionVideoEndedEventArgs.g.cs @@ -0,0 +1,25 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SceneTransitionVideoEnded</c> event. +/// +/// +/// A scene transition's video has completed fully. +/// +/// Useful for stinger transitions to tell when the video *actually* ends. +/// `SceneTransitionEnded` only signifies the cut point, not the completion of transition playback. +/// +/// Note: Appears to be called by every transition, regardless of relevance. +/// Requires Subscription: Transitions | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SceneTransitionVideoEndedEventArgs(SceneTransitionVideoEndedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/ScreenshotSavedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/ScreenshotSavedEventArgs.g.cs new file mode 100644 index 0000000..1422ea0 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/ScreenshotSavedEventArgs.g.cs @@ -0,0 +1,24 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>ScreenshotSaved</c> event. +/// +/// +/// A screenshot has been saved. +/// +/// Note: Triggered for the screenshot feature available in `Settings -> Hotkeys -> Screenshot Output` ONLY. +/// Applications using `Get/SaveSourceScreenshot` should implement a `CustomEvent` if this kind of inter-client +/// communication is desired. +/// Requires Subscription: Ui | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.1.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class ScreenshotSavedEventArgs(ScreenshotSavedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterCreatedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterCreatedEventArgs.g.cs new file mode 100644 index 0000000..db7cb53 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterCreatedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SourceFilterCreated</c> event. +/// +/// +/// A filter has been added to a source. +/// Requires Subscription: Filters | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SourceFilterCreatedEventArgs(SourceFilterCreatedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterEnableStateChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterEnableStateChangedEventArgs.g.cs new file mode 100644 index 0000000..0e34d33 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterEnableStateChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SourceFilterEnableStateChanged</c> event. +/// +/// +/// A source filter's enable state has changed. +/// Requires Subscription: Filters | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SourceFilterEnableStateChangedEventArgs(SourceFilterEnableStateChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterListReindexedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterListReindexedEventArgs.g.cs new file mode 100644 index 0000000..9ee6d30 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterListReindexedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SourceFilterListReindexed</c> event. +/// +/// +/// A source's filter list has been reindexed. +/// Requires Subscription: Filters | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SourceFilterListReindexedEventArgs(SourceFilterListReindexedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterNameChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterNameChangedEventArgs.g.cs new file mode 100644 index 0000000..30d4755 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterNameChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SourceFilterNameChanged</c> event. +/// +/// +/// The name of a source filter has changed. +/// Requires Subscription: Filters | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SourceFilterNameChangedEventArgs(SourceFilterNameChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterRemovedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterRemovedEventArgs.g.cs new file mode 100644 index 0000000..479a680 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterRemovedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SourceFilterRemoved</c> event. +/// +/// +/// A filter has been removed from a source. +/// Requires Subscription: Filters | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SourceFilterRemovedEventArgs(SourceFilterRemovedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterSettingsChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterSettingsChangedEventArgs.g.cs new file mode 100644 index 0000000..6a84805 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/SourceFilterSettingsChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>SourceFilterSettingsChanged</c> event. +/// +/// +/// An source filter's settings have changed (been updated). +/// Requires Subscription: Filters | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.4.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class SourceFilterSettingsChangedEventArgs(SourceFilterSettingsChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/StreamStateChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/StreamStateChangedEventArgs.g.cs new file mode 100644 index 0000000..e03f632 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/StreamStateChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>StreamStateChanged</c> event. +/// +/// +/// The state of the stream output has changed. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class StreamStateChangedEventArgs(StreamStateChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/StudioModeStateChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/StudioModeStateChangedEventArgs.g.cs new file mode 100644 index 0000000..07502c5 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/StudioModeStateChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>StudioModeStateChanged</c> event. +/// +/// +/// Studio mode has been enabled or disabled. +/// Requires Subscription: Ui | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class StudioModeStateChangedEventArgs(StudioModeStateChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/VendorEventEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/VendorEventEventArgs.g.cs new file mode 100644 index 0000000..5bae364 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/VendorEventEventArgs.g.cs @@ -0,0 +1,23 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>VendorEvent</c> event. +/// +/// +/// An event has been emitted from a vendor. +/// +/// A vendor is a unique name registered by a third-party plugin or script, which allows for custom requests and events to be added to obs-websocket. +/// If a plugin or script implements vendor requests or events, documentation is expected to be provided with them. +/// Requires Subscription: Vendors | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class VendorEventEventArgs(VendorEventPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Events/Generated/VirtualcamStateChangedEventArgs.g.cs b/ObsWebSocket.Core/Generated/Events/Generated/VirtualcamStateChangedEventArgs.g.cs new file mode 100644 index 0000000..0ef7413 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Events/Generated/VirtualcamStateChangedEventArgs.g.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Events; + +namespace ObsWebSocket.Core.Events.Generated; + +/// +/// Provides event data for the <c>VirtualcamStateChanged</c> event. +/// +/// +/// The state of the virtualcam output has changed. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +/// The strongly-typed data payload () for this event. +public sealed partial class VirtualcamStateChangedEventArgs(VirtualcamStateChangedPayload payload) : ObsEventEventArgs(payload) +{ +} diff --git a/ObsWebSocket.Core/Generated/Protocol/Common/NestedTypes/TriggerHotkeyByKeySequenceRequestData_KeyModifiers.g.cs b/ObsWebSocket.Core/Generated/Protocol/Common/NestedTypes/TriggerHotkeyByKeySequenceRequestData_KeyModifiers.g.cs new file mode 100644 index 0000000..95ed44f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Common/NestedTypes/TriggerHotkeyByKeySequenceRequestData_KeyModifiers.g.cs @@ -0,0 +1,71 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; + +namespace ObsWebSocket.Core.Protocol.Common.NestedTypes; + +/// +/// Represents the nested 'keyModifiers' structure. +/// +/// +/// Represents the nested 'keyModifiers' structure used within TriggerHotkeyByKeySequenceRequestData. +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record TriggerHotkeyByKeySequenceRequestData_KeyModifiers +{ + /// + /// Press ALT + /// + [JsonPropertyName("alt")] + [Key("alt")] + public required bool Alt { get; init; } + + /// + /// Press CMD (Mac) + /// + [JsonPropertyName("command")] + [Key("command")] + public required bool Command { get; init; } + + /// + /// Press CTRL + /// + [JsonPropertyName("control")] + [Key("control")] + public required bool Control { get; init; } + + /// + /// Press Shift + /// + [JsonPropertyName("shift")] + [Key("shift")] + public required bool Shift { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public TriggerHotkeyByKeySequenceRequestData_KeyModifiers() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TriggerHotkeyByKeySequenceRequestData_KeyModifiers(bool alt, bool command, bool control, bool shift) + { + this.Alt = alt; + this.Command = command; + this.Control = control; + this.Shift = shift; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/CurrentPreviewSceneChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentPreviewSceneChanged.EventPayload.g.cs new file mode 100644 index 0000000..5617e41 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentPreviewSceneChanged.EventPayload.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the CurrentPreviewSceneChanged event. +/// +/// +/// The current preview scene has changed. +/// Requires Subscription: Scenes | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CurrentPreviewSceneChangedPayload +{ + /// + /// Name of the scene that was switched to + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene that was switched to + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CurrentPreviewSceneChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CurrentPreviewSceneChangedPayload(string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/CurrentProfileChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentProfileChanged.EventPayload.g.cs new file mode 100644 index 0000000..1c0d6b3 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentProfileChanged.EventPayload.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the CurrentProfileChanged event. +/// +/// +/// The current profile has changed. +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CurrentProfileChangedPayload +{ + /// + /// Name of the new profile + /// + [JsonPropertyName("profileName")] + [Key("profileName")] + public string? ProfileName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CurrentProfileChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CurrentProfileChangedPayload(string? profileName = null) + { + this.ProfileName = profileName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/CurrentProfileChanging.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentProfileChanging.EventPayload.g.cs new file mode 100644 index 0000000..55d23d2 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentProfileChanging.EventPayload.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the CurrentProfileChanging event. +/// +/// +/// The current profile has begun changing. +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CurrentProfileChangingPayload +{ + /// + /// Name of the current profile + /// + [JsonPropertyName("profileName")] + [Key("profileName")] + public string? ProfileName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CurrentProfileChangingPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CurrentProfileChangingPayload(string? profileName = null) + { + this.ProfileName = profileName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/CurrentProgramSceneChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentProgramSceneChanged.EventPayload.g.cs new file mode 100644 index 0000000..78c6388 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentProgramSceneChanged.EventPayload.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the CurrentProgramSceneChanged event. +/// +/// +/// The current program scene has changed. +/// Requires Subscription: Scenes | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CurrentProgramSceneChangedPayload +{ + /// + /// Name of the scene that was switched to + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene that was switched to + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CurrentProgramSceneChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CurrentProgramSceneChangedPayload(string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneCollectionChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneCollectionChanged.EventPayload.g.cs new file mode 100644 index 0000000..b9fbe31 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneCollectionChanged.EventPayload.g.cs @@ -0,0 +1,51 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the CurrentSceneCollectionChanged event. +/// +/// +/// The current scene collection has changed. +/// +/// Note: If polling has been paused during `CurrentSceneCollectionChanging`, this is the que to restart polling. +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CurrentSceneCollectionChangedPayload +{ + /// + /// Name of the new scene collection + /// + [JsonPropertyName("sceneCollectionName")] + [Key("sceneCollectionName")] + public string? SceneCollectionName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CurrentSceneCollectionChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CurrentSceneCollectionChangedPayload(string? sceneCollectionName = null) + { + this.SceneCollectionName = sceneCollectionName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneCollectionChanging.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneCollectionChanging.EventPayload.g.cs new file mode 100644 index 0000000..a1b6c61 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneCollectionChanging.EventPayload.g.cs @@ -0,0 +1,52 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the CurrentSceneCollectionChanging event. +/// +/// +/// The current scene collection has begun changing. +/// +/// Note: We recommend using this event to trigger a pause of all polling requests, as performing any requests during a +/// scene collection change is considered undefined behavior and can cause crashes! +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CurrentSceneCollectionChangingPayload +{ + /// + /// Name of the current scene collection + /// + [JsonPropertyName("sceneCollectionName")] + [Key("sceneCollectionName")] + public string? SceneCollectionName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CurrentSceneCollectionChangingPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CurrentSceneCollectionChangingPayload(string? sceneCollectionName = null) + { + this.SceneCollectionName = sceneCollectionName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneTransitionChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneTransitionChanged.EventPayload.g.cs new file mode 100644 index 0000000..202876a --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneTransitionChanged.EventPayload.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the CurrentSceneTransitionChanged event. +/// +/// +/// The current scene transition has changed. +/// Requires Subscription: Transitions | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CurrentSceneTransitionChangedPayload +{ + /// + /// Name of the new transition + /// + [JsonPropertyName("transitionName")] + [Key("transitionName")] + public string? TransitionName { get; init; } + + /// + /// UUID of the new transition + /// + [JsonPropertyName("transitionUuid")] + [Key("transitionUuid")] + public string? TransitionUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CurrentSceneTransitionChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CurrentSceneTransitionChangedPayload(string? transitionName = null, string? transitionUuid = null) + { + this.TransitionName = transitionName; + this.TransitionUuid = transitionUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneTransitionDurationChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneTransitionDurationChanged.EventPayload.g.cs new file mode 100644 index 0000000..b31234b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/CurrentSceneTransitionDurationChanged.EventPayload.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the CurrentSceneTransitionDurationChanged event. +/// +/// +/// The current scene transition duration has changed. +/// Requires Subscription: Transitions | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CurrentSceneTransitionDurationChangedPayload +{ + /// + /// Transition duration in milliseconds + /// + [JsonPropertyName("transitionDuration")] + [Key("transitionDuration")] + public required double TransitionDuration { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CurrentSceneTransitionDurationChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CurrentSceneTransitionDurationChangedPayload(double transitionDuration) + { + this.TransitionDuration = transitionDuration; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/CustomEvent.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/CustomEvent.EventPayload.g.cs new file mode 100644 index 0000000..6540d45 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/CustomEvent.EventPayload.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the CustomEvent event. +/// +/// +/// Custom event emitted by `BroadcastCustomEvent`. +/// Requires Subscription: General | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CustomEventPayload +{ + /// + /// Custom event data + /// + [JsonPropertyName("eventData")] + [Key("eventData")] + public System.Text.Json.JsonElement? EventData { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CustomEventPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CustomEventPayload(System.Text.Json.JsonElement? eventData = null) + { + this.EventData = eventData; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputActiveStateChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputActiveStateChanged.EventPayload.g.cs new file mode 100644 index 0000000..c4e0cea --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputActiveStateChanged.EventPayload.g.cs @@ -0,0 +1,68 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputActiveStateChanged event. +/// +/// +/// An input's active state has changed. +/// +/// When an input is active, it means it's being shown by the program feed. +/// Requires Subscription: InputActiveStateChanged | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputActiveStateChangedPayload +{ + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// Whether the input is active + /// + [JsonPropertyName("videoActive")] + [Key("videoActive")] + public required bool VideoActive { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputActiveStateChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputActiveStateChangedPayload(bool videoActive, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.VideoActive = videoActive; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioBalanceChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioBalanceChanged.EventPayload.g.cs new file mode 100644 index 0000000..aac65ae --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioBalanceChanged.EventPayload.g.cs @@ -0,0 +1,66 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputAudioBalanceChanged event. +/// +/// +/// The audio balance value of an input has changed. +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputAudioBalanceChangedPayload +{ + /// + /// New audio balance value of the input + /// + [JsonPropertyName("inputAudioBalance")] + [Key("inputAudioBalance")] + public required double InputAudioBalance { get; init; } + + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputAudioBalanceChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputAudioBalanceChangedPayload(double inputAudioBalance, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputAudioBalance = inputAudioBalance; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioMonitorTypeChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioMonitorTypeChanged.EventPayload.g.cs new file mode 100644 index 0000000..2cf962d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioMonitorTypeChanged.EventPayload.g.cs @@ -0,0 +1,71 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputAudioMonitorTypeChanged event. +/// +/// +/// The monitor type of an input has changed. +/// +/// Available types are: +/// +/// - `OBS_MONITORING_TYPE_NONE` +/// - `OBS_MONITORING_TYPE_MONITOR_ONLY` +/// - `OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT` +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputAudioMonitorTypeChangedPayload +{ + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// New monitor type of the input + /// + [JsonPropertyName("monitorType")] + [Key("monitorType")] + public string? MonitorType { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputAudioMonitorTypeChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public InputAudioMonitorTypeChangedPayload(string? inputName = null, string? inputUuid = null, string? monitorType = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.MonitorType = monitorType; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioSyncOffsetChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioSyncOffsetChanged.EventPayload.g.cs new file mode 100644 index 0000000..41ccd26 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioSyncOffsetChanged.EventPayload.g.cs @@ -0,0 +1,66 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputAudioSyncOffsetChanged event. +/// +/// +/// The sync offset of an input has changed. +/// Requires Subscription: Inputs | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputAudioSyncOffsetChangedPayload +{ + /// + /// New sync offset in milliseconds + /// + [JsonPropertyName("inputAudioSyncOffset")] + [Key("inputAudioSyncOffset")] + public required double InputAudioSyncOffset { get; init; } + + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputAudioSyncOffsetChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputAudioSyncOffsetChangedPayload(double inputAudioSyncOffset, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputAudioSyncOffset = inputAudioSyncOffset; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioTracksChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioTracksChanged.EventPayload.g.cs new file mode 100644 index 0000000..560c00b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputAudioTracksChanged.EventPayload.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputAudioTracksChanged event. +/// +/// +/// The audio tracks of an input have changed. +/// Requires Subscription: Inputs | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputAudioTracksChangedPayload +{ + /// + /// Object of audio tracks along with their associated enable states + /// + [JsonPropertyName("inputAudioTracks")] + [Key("inputAudioTracks")] + public System.Collections.Generic.Dictionary? InputAudioTracks { get; init; } + + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputAudioTracksChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public InputAudioTracksChangedPayload(string? inputName = null, string? inputUuid = null, System.Collections.Generic.Dictionary? inputAudioTracks = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputAudioTracks = inputAudioTracks; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputCreated.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputCreated.EventPayload.g.cs new file mode 100644 index 0000000..1d86762 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputCreated.EventPayload.g.cs @@ -0,0 +1,98 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputCreated event. +/// +/// +/// An input has been created. +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputCreatedPayload +{ + /// + /// The default settings for the input + /// + [JsonPropertyName("defaultInputSettings")] + [Key("defaultInputSettings")] + public System.Text.Json.JsonElement? DefaultInputSettings { get; init; } + + /// + /// The kind of the input + /// + [JsonPropertyName("inputKind")] + [Key("inputKind")] + public string? InputKind { get; init; } + + /// + /// Bitflag value for the caps that an input supports. See obs_source_info.output_flags in the libobs docs + /// + [JsonPropertyName("inputKindCaps")] + [Key("inputKindCaps")] + public required double InputKindCaps { get; init; } + + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// The settings configured to the input when it was created + /// + [JsonPropertyName("inputSettings")] + [Key("inputSettings")] + public System.Text.Json.JsonElement? InputSettings { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// The unversioned kind of input (aka no `_v2` stuff) + /// + [JsonPropertyName("unversionedInputKind")] + [Key("unversionedInputKind")] + public string? UnversionedInputKind { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputCreatedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputCreatedPayload(double inputKindCaps, string? inputName = null, string? inputUuid = null, string? inputKind = null, string? unversionedInputKind = null, System.Text.Json.JsonElement? inputSettings = null, System.Text.Json.JsonElement? defaultInputSettings = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputKind = inputKind; + this.UnversionedInputKind = unversionedInputKind; + this.InputKindCaps = inputKindCaps; + this.InputSettings = inputSettings; + this.DefaultInputSettings = defaultInputSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputMuteStateChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputMuteStateChanged.EventPayload.g.cs new file mode 100644 index 0000000..9af23b7 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputMuteStateChanged.EventPayload.g.cs @@ -0,0 +1,66 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputMuteStateChanged event. +/// +/// +/// An input's mute state has changed. +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputMuteStateChangedPayload +{ + /// + /// Whether the input is muted + /// + [JsonPropertyName("inputMuted")] + [Key("inputMuted")] + public required bool InputMuted { get; init; } + + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputMuteStateChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputMuteStateChangedPayload(bool inputMuted, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputMuted = inputMuted; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputNameChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputNameChanged.EventPayload.g.cs new file mode 100644 index 0000000..fb8163b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputNameChanged.EventPayload.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputNameChanged event. +/// +/// +/// The name of an input has changed. +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputNameChangedPayload +{ + /// + /// New name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// Old name of the input + /// + [JsonPropertyName("oldInputName")] + [Key("oldInputName")] + public string? OldInputName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputNameChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public InputNameChangedPayload(string? inputUuid = null, string? oldInputName = null, string? inputName = null) + { + this.InputUuid = inputUuid; + this.OldInputName = oldInputName; + this.InputName = inputName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputRemoved.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputRemoved.EventPayload.g.cs new file mode 100644 index 0000000..c433e84 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputRemoved.EventPayload.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputRemoved event. +/// +/// +/// An input has been removed. +/// Requires Subscription: Inputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputRemovedPayload +{ + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputRemovedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public InputRemovedPayload(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputSettingsChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputSettingsChanged.EventPayload.g.cs new file mode 100644 index 0000000..1cbd118 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputSettingsChanged.EventPayload.g.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputSettingsChanged event. +/// +/// +/// An input's settings have changed (been updated). +/// +/// Note: On some inputs, changing values in the properties dialog will cause an immediate update. Pressing the "Cancel" button will revert the settings, resulting in another event being fired. +/// Requires Subscription: Inputs | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.4.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputSettingsChangedPayload +{ + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// New settings object of the input + /// + [JsonPropertyName("inputSettings")] + [Key("inputSettings")] + public System.Text.Json.JsonElement? InputSettings { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputSettingsChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public InputSettingsChangedPayload(string? inputName = null, string? inputUuid = null, System.Text.Json.JsonElement? inputSettings = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputSettings = inputSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputShowStateChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputShowStateChanged.EventPayload.g.cs new file mode 100644 index 0000000..ceb21db --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputShowStateChanged.EventPayload.g.cs @@ -0,0 +1,68 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputShowStateChanged event. +/// +/// +/// An input's show state has changed. +/// +/// When an input is showing, it means it's being shown by the preview or a dialog. +/// Requires Subscription: InputShowStateChanged | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputShowStateChangedPayload +{ + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// Whether the input is showing + /// + [JsonPropertyName("videoShowing")] + [Key("videoShowing")] + public required bool VideoShowing { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputShowStateChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputShowStateChangedPayload(bool videoShowing, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.VideoShowing = videoShowing; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputVolumeChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputVolumeChanged.EventPayload.g.cs new file mode 100644 index 0000000..677cdfb --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputVolumeChanged.EventPayload.g.cs @@ -0,0 +1,74 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputVolumeChanged event. +/// +/// +/// An input's volume level has changed. +/// Requires Subscription: Inputs | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputVolumeChangedPayload +{ + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// New volume level in dB + /// + [JsonPropertyName("inputVolumeDb")] + [Key("inputVolumeDb")] + public required double InputVolumeDb { get; init; } + + /// + /// New volume level multiplier + /// + [JsonPropertyName("inputVolumeMul")] + [Key("inputVolumeMul")] + public required double InputVolumeMul { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputVolumeChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public InputVolumeChangedPayload(double inputVolumeMul, double inputVolumeDb, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputVolumeMul = inputVolumeMul; + this.InputVolumeDb = inputVolumeDb; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/InputVolumeMeters.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/InputVolumeMeters.EventPayload.g.cs new file mode 100644 index 0000000..1c231ca --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/InputVolumeMeters.EventPayload.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the InputVolumeMeters event. +/// +/// +/// A high-volume event providing volume levels of all active inputs every 50 milliseconds. +/// Requires Subscription: InputVolumeMeters | Complexity: 4 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record InputVolumeMetersPayload +{ + /// + /// Array of active inputs with their associated volume levels + /// + [JsonPropertyName("inputs")] + [Key("inputs")] + public System.Collections.Generic.List? Inputs { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public InputVolumeMetersPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public InputVolumeMetersPayload(System.Collections.Generic.List? inputs = null) + { + this.Inputs = inputs; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/MediaInputActionTriggered.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/MediaInputActionTriggered.EventPayload.g.cs new file mode 100644 index 0000000..c279ad1 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/MediaInputActionTriggered.EventPayload.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the MediaInputActionTriggered event. +/// +/// +/// An action has been performed on an input. +/// Requires Subscription: MediaInputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record MediaInputActionTriggeredPayload +{ + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// Action performed on the input. See `ObsMediaInputAction` enum + /// + [JsonPropertyName("mediaAction")] + [Key("mediaAction")] + public string? MediaAction { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public MediaInputActionTriggeredPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public MediaInputActionTriggeredPayload(string? inputName = null, string? inputUuid = null, string? mediaAction = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.MediaAction = mediaAction; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/MediaInputPlaybackEnded.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/MediaInputPlaybackEnded.EventPayload.g.cs new file mode 100644 index 0000000..aa100b7 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/MediaInputPlaybackEnded.EventPayload.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the MediaInputPlaybackEnded event. +/// +/// +/// A media input has finished playing. +/// Requires Subscription: MediaInputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record MediaInputPlaybackEndedPayload +{ + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public MediaInputPlaybackEndedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public MediaInputPlaybackEndedPayload(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/MediaInputPlaybackStarted.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/MediaInputPlaybackStarted.EventPayload.g.cs new file mode 100644 index 0000000..0fe00ba --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/MediaInputPlaybackStarted.EventPayload.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the MediaInputPlaybackStarted event. +/// +/// +/// A media input has started playing. +/// Requires Subscription: MediaInputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record MediaInputPlaybackStartedPayload +{ + /// + /// Name of the input + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public MediaInputPlaybackStartedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public MediaInputPlaybackStartedPayload(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/ProfileListChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/ProfileListChanged.EventPayload.g.cs new file mode 100644 index 0000000..071862f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/ProfileListChanged.EventPayload.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the ProfileListChanged event. +/// +/// +/// The profile list has changed. +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ProfileListChangedPayload +{ + /// + /// Updated list of profiles + /// + [JsonPropertyName("profiles")] + [Key("profiles")] + public System.Collections.Generic.List? Profiles { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ProfileListChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public ProfileListChangedPayload(System.Collections.Generic.List? profiles = null) + { + this.Profiles = profiles; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/RecordFileChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/RecordFileChanged.EventPayload.g.cs new file mode 100644 index 0000000..21dfe13 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/RecordFileChanged.EventPayload.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the RecordFileChanged event. +/// +/// +/// The record output has started writing to a new file. For example, when a file split happens. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.5.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record RecordFileChangedPayload +{ + /// + /// File name that the output has begun writing to + /// + [JsonPropertyName("newOutputPath")] + [Key("newOutputPath")] + public string? NewOutputPath { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public RecordFileChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public RecordFileChangedPayload(string? newOutputPath = null) + { + this.NewOutputPath = newOutputPath; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/RecordStateChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/RecordStateChanged.EventPayload.g.cs new file mode 100644 index 0000000..c255a07 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/RecordStateChanged.EventPayload.g.cs @@ -0,0 +1,66 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the RecordStateChanged event. +/// +/// +/// The state of the record output has changed. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record RecordStateChangedPayload +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// + /// File name for the saved recording, if record stopped. `null` otherwise + /// + [JsonPropertyName("outputPath")] + [Key("outputPath")] + public string? OutputPath { get; init; } + + /// + /// The specific state of the output + /// + [JsonPropertyName("outputState")] + [Key("outputState")] + public string? OutputState { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public RecordStateChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RecordStateChangedPayload(bool outputActive, string? outputState = null, string? outputPath = null) + { + this.OutputActive = outputActive; + this.OutputState = outputState; + this.OutputPath = outputPath; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/ReplayBufferSaved.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/ReplayBufferSaved.EventPayload.g.cs new file mode 100644 index 0000000..0eaa21f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/ReplayBufferSaved.EventPayload.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the ReplayBufferSaved event. +/// +/// +/// The replay buffer has been saved. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ReplayBufferSavedPayload +{ + /// + /// Path of the saved replay file + /// + [JsonPropertyName("savedReplayPath")] + [Key("savedReplayPath")] + public string? SavedReplayPath { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ReplayBufferSavedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public ReplayBufferSavedPayload(string? savedReplayPath = null) + { + this.SavedReplayPath = savedReplayPath; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/ReplayBufferStateChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/ReplayBufferStateChanged.EventPayload.g.cs new file mode 100644 index 0000000..4024dc7 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/ReplayBufferStateChanged.EventPayload.g.cs @@ -0,0 +1,58 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the ReplayBufferStateChanged event. +/// +/// +/// The state of the replay buffer output has changed. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ReplayBufferStateChangedPayload +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// + /// The specific state of the output + /// + [JsonPropertyName("outputState")] + [Key("outputState")] + public string? OutputState { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ReplayBufferStateChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ReplayBufferStateChangedPayload(bool outputActive, string? outputState = null) + { + this.OutputActive = outputActive; + this.OutputState = outputState; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneCollectionListChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneCollectionListChanged.EventPayload.g.cs new file mode 100644 index 0000000..c3d41de --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneCollectionListChanged.EventPayload.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneCollectionListChanged event. +/// +/// +/// The scene collection list has changed. +/// Requires Subscription: Config | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneCollectionListChangedPayload +{ + /// + /// Updated list of scene collections + /// + [JsonPropertyName("sceneCollections")] + [Key("sceneCollections")] + public System.Collections.Generic.List? SceneCollections { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneCollectionListChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SceneCollectionListChangedPayload(System.Collections.Generic.List? sceneCollections = null) + { + this.SceneCollections = sceneCollections; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneCreated.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneCreated.EventPayload.g.cs new file mode 100644 index 0000000..096fb2b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneCreated.EventPayload.g.cs @@ -0,0 +1,66 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneCreated event. +/// +/// +/// A new scene has been created. +/// Requires Subscription: Scenes | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneCreatedPayload +{ + /// + /// Whether the new scene is a group + /// + [JsonPropertyName("isGroup")] + [Key("isGroup")] + public required bool IsGroup { get; init; } + + /// + /// Name of the new scene + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the new scene + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneCreatedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SceneCreatedPayload(bool isGroup, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.IsGroup = isGroup; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemCreated.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemCreated.EventPayload.g.cs new file mode 100644 index 0000000..025c25e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemCreated.EventPayload.g.cs @@ -0,0 +1,90 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneItemCreated event. +/// +/// +/// A scene item has been created. +/// Requires Subscription: SceneItems | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneItemCreatedPayload +{ + /// + /// Numeric ID of the scene item + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Index position of the item + /// + [JsonPropertyName("sceneItemIndex")] + [Key("sceneItemIndex")] + public required double SceneItemIndex { get; init; } + + /// + /// Name of the scene the item was added to + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item was added to + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// + /// Name of the underlying source (input/scene) + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the underlying source (input/scene) + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneItemCreatedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SceneItemCreatedPayload(double sceneItemId, double sceneItemIndex, string? sceneName = null, string? sceneUuid = null, string? sourceName = null, string? sourceUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.SceneItemId = sceneItemId; + this.SceneItemIndex = sceneItemIndex; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemEnableStateChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemEnableStateChanged.EventPayload.g.cs new file mode 100644 index 0000000..86e8a26 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemEnableStateChanged.EventPayload.g.cs @@ -0,0 +1,74 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneItemEnableStateChanged event. +/// +/// +/// A scene item's enable state has changed. +/// Requires Subscription: SceneItems | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneItemEnableStateChangedPayload +{ + /// + /// Whether the scene item is enabled (visible) + /// + [JsonPropertyName("sceneItemEnabled")] + [Key("sceneItemEnabled")] + public required bool SceneItemEnabled { get; init; } + + /// + /// Numeric ID of the scene item + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneItemEnableStateChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SceneItemEnableStateChangedPayload(double sceneItemId, bool sceneItemEnabled, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + this.SceneItemEnabled = sceneItemEnabled; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemListReindexed.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemListReindexed.EventPayload.g.cs new file mode 100644 index 0000000..cffcdb6 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemListReindexed.EventPayload.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneItemListReindexed event. +/// +/// +/// A scene's item list has been reindexed. +/// Requires Subscription: SceneItems | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneItemListReindexedPayload +{ + /// + /// Array of scene item objects + /// + [JsonPropertyName("sceneItems")] + [Key("sceneItems")] + public System.Collections.Generic.List? SceneItems { get; init; } + + /// + /// Name of the scene + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneItemListReindexedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SceneItemListReindexedPayload(string? sceneName = null, string? sceneUuid = null, System.Collections.Generic.List? sceneItems = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItems = sceneItems; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemLockStateChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemLockStateChanged.EventPayload.g.cs new file mode 100644 index 0000000..7680fb5 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemLockStateChanged.EventPayload.g.cs @@ -0,0 +1,74 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneItemLockStateChanged event. +/// +/// +/// A scene item's lock state has changed. +/// Requires Subscription: SceneItems | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneItemLockStateChangedPayload +{ + /// + /// Numeric ID of the scene item + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Whether the scene item is locked + /// + [JsonPropertyName("sceneItemLocked")] + [Key("sceneItemLocked")] + public required bool SceneItemLocked { get; init; } + + /// + /// Name of the scene the item is in + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneItemLockStateChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SceneItemLockStateChangedPayload(double sceneItemId, bool sceneItemLocked, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + this.SceneItemLocked = sceneItemLocked; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemRemoved.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemRemoved.EventPayload.g.cs new file mode 100644 index 0000000..cd52e03 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemRemoved.EventPayload.g.cs @@ -0,0 +1,84 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneItemRemoved event. +/// +/// +/// A scene item has been removed. +/// +/// This event is not emitted when the scene the item is in is removed. +/// Requires Subscription: SceneItems | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneItemRemovedPayload +{ + /// + /// Numeric ID of the scene item + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item was removed from + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item was removed from + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// + /// Name of the underlying source (input/scene) + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the underlying source (input/scene) + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneItemRemovedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SceneItemRemovedPayload(double sceneItemId, string? sceneName = null, string? sceneUuid = null, string? sourceName = null, string? sourceUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemSelected.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemSelected.EventPayload.g.cs new file mode 100644 index 0000000..84b6077 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemSelected.EventPayload.g.cs @@ -0,0 +1,66 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneItemSelected event. +/// +/// +/// A scene item has been selected in the Ui. +/// Requires Subscription: SceneItems | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneItemSelectedPayload +{ + /// + /// Numeric ID of the scene item + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneItemSelectedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SceneItemSelectedPayload(double sceneItemId, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemTransformChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemTransformChanged.EventPayload.g.cs new file mode 100644 index 0000000..545617b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneItemTransformChanged.EventPayload.g.cs @@ -0,0 +1,74 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneItemTransformChanged event. +/// +/// +/// The transform/crop of a scene item has changed. +/// Requires Subscription: SceneItemTransformChanged | Complexity: 4 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneItemTransformChangedPayload +{ + /// + /// Numeric ID of the scene item + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// New transform/crop info of the scene item + /// + [JsonPropertyName("sceneItemTransform")] + [Key("sceneItemTransform")] + public ObsWebSocket.Core.Protocol.Common.SceneItemTransformStub? SceneItemTransform { get; init; } + + /// + /// The name of the scene the item is in + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// The UUID of the scene the item is in + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneItemTransformChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SceneItemTransformChangedPayload(double sceneItemId, string? sceneName = null, string? sceneUuid = null, ObsWebSocket.Core.Protocol.Common.SceneItemTransformStub? sceneItemTransform = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + this.SceneItemTransform = sceneItemTransform; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneListChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneListChanged.EventPayload.g.cs new file mode 100644 index 0000000..98aa9a3 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneListChanged.EventPayload.g.cs @@ -0,0 +1,51 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneListChanged event. +/// +/// +/// The list of scenes has changed. +/// +/// TODO: Make OBS fire this event when scenes are reordered. +/// Requires Subscription: Scenes | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneListChangedPayload +{ + /// + /// Updated array of scenes + /// + [JsonPropertyName("scenes")] + [Key("scenes")] + public System.Collections.Generic.List? Scenes { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneListChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SceneListChangedPayload(System.Collections.Generic.List? scenes = null) + { + this.Scenes = scenes; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneNameChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneNameChanged.EventPayload.g.cs new file mode 100644 index 0000000..c664e25 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneNameChanged.EventPayload.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneNameChanged event. +/// +/// +/// The name of a scene has changed. +/// Requires Subscription: Scenes | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneNameChangedPayload +{ + /// + /// Old name of the scene + /// + [JsonPropertyName("oldSceneName")] + [Key("oldSceneName")] + public string? OldSceneName { get; init; } + + /// + /// New name of the scene + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneNameChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SceneNameChangedPayload(string? sceneUuid = null, string? oldSceneName = null, string? sceneName = null) + { + this.SceneUuid = sceneUuid; + this.OldSceneName = oldSceneName; + this.SceneName = sceneName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneRemoved.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneRemoved.EventPayload.g.cs new file mode 100644 index 0000000..5e17f20 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneRemoved.EventPayload.g.cs @@ -0,0 +1,66 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneRemoved event. +/// +/// +/// A scene has been removed. +/// Requires Subscription: Scenes | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneRemovedPayload +{ + /// + /// Whether the scene was a group + /// + [JsonPropertyName("isGroup")] + [Key("isGroup")] + public required bool IsGroup { get; init; } + + /// + /// Name of the removed scene + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the removed scene + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneRemovedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SceneRemovedPayload(bool isGroup, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.IsGroup = isGroup; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneTransitionEnded.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneTransitionEnded.EventPayload.g.cs new file mode 100644 index 0000000..43902d7 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneTransitionEnded.EventPayload.g.cs @@ -0,0 +1,59 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneTransitionEnded event. +/// +/// +/// A scene transition has completed fully. +/// +/// Note: Does not appear to trigger when the transition is interrupted by the user. +/// Requires Subscription: Transitions | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneTransitionEndedPayload +{ + /// + /// Scene transition name + /// + [JsonPropertyName("transitionName")] + [Key("transitionName")] + public string? TransitionName { get; init; } + + /// + /// Scene transition UUID + /// + [JsonPropertyName("transitionUuid")] + [Key("transitionUuid")] + public string? TransitionUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneTransitionEndedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SceneTransitionEndedPayload(string? transitionName = null, string? transitionUuid = null) + { + this.TransitionName = transitionName; + this.TransitionUuid = transitionUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneTransitionStarted.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneTransitionStarted.EventPayload.g.cs new file mode 100644 index 0000000..00d0c4e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneTransitionStarted.EventPayload.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneTransitionStarted event. +/// +/// +/// A scene transition has started. +/// Requires Subscription: Transitions | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneTransitionStartedPayload +{ + /// + /// Scene transition name + /// + [JsonPropertyName("transitionName")] + [Key("transitionName")] + public string? TransitionName { get; init; } + + /// + /// Scene transition UUID + /// + [JsonPropertyName("transitionUuid")] + [Key("transitionUuid")] + public string? TransitionUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneTransitionStartedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SceneTransitionStartedPayload(string? transitionName = null, string? transitionUuid = null) + { + this.TransitionName = transitionName; + this.TransitionUuid = transitionUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SceneTransitionVideoEnded.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SceneTransitionVideoEnded.EventPayload.g.cs new file mode 100644 index 0000000..2e65463 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SceneTransitionVideoEnded.EventPayload.g.cs @@ -0,0 +1,62 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SceneTransitionVideoEnded event. +/// +/// +/// A scene transition's video has completed fully. +/// +/// Useful for stinger transitions to tell when the video *actually* ends. +/// `SceneTransitionEnded` only signifies the cut point, not the completion of transition playback. +/// +/// Note: Appears to be called by every transition, regardless of relevance. +/// Requires Subscription: Transitions | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SceneTransitionVideoEndedPayload +{ + /// + /// Scene transition name + /// + [JsonPropertyName("transitionName")] + [Key("transitionName")] + public string? TransitionName { get; init; } + + /// + /// Scene transition UUID + /// + [JsonPropertyName("transitionUuid")] + [Key("transitionUuid")] + public string? TransitionUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SceneTransitionVideoEndedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SceneTransitionVideoEndedPayload(string? transitionName = null, string? transitionUuid = null) + { + this.TransitionName = transitionName; + this.TransitionUuid = transitionUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/ScreenshotSaved.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/ScreenshotSaved.EventPayload.g.cs new file mode 100644 index 0000000..9c332a3 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/ScreenshotSaved.EventPayload.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the ScreenshotSaved event. +/// +/// +/// A screenshot has been saved. +/// +/// Note: Triggered for the screenshot feature available in `Settings -> Hotkeys -> Screenshot Output` ONLY. +/// Applications using `Get/SaveSourceScreenshot` should implement a `CustomEvent` if this kind of inter-client +/// communication is desired. +/// Requires Subscription: Ui | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.1.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ScreenshotSavedPayload +{ + /// + /// Path of the saved image file + /// + [JsonPropertyName("savedScreenshotPath")] + [Key("savedScreenshotPath")] + public string? SavedScreenshotPath { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ScreenshotSavedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public ScreenshotSavedPayload(string? savedScreenshotPath = null) + { + this.SavedScreenshotPath = savedScreenshotPath; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterCreated.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterCreated.EventPayload.g.cs new file mode 100644 index 0000000..a4512ca --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterCreated.EventPayload.g.cs @@ -0,0 +1,90 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SourceFilterCreated event. +/// +/// +/// A filter has been added to a source. +/// Requires Subscription: Filters | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SourceFilterCreatedPayload +{ + /// + /// The default settings for the filter + /// + [JsonPropertyName("defaultFilterSettings")] + [Key("defaultFilterSettings")] + public System.Text.Json.JsonElement? DefaultFilterSettings { get; init; } + + /// + /// Index position of the filter + /// + [JsonPropertyName("filterIndex")] + [Key("filterIndex")] + public required double FilterIndex { get; init; } + + /// + /// The kind of the filter + /// + [JsonPropertyName("filterKind")] + [Key("filterKind")] + public string? FilterKind { get; init; } + + /// + /// Name of the filter + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public string? FilterName { get; init; } + + /// + /// The settings configured to the filter when it was created + /// + [JsonPropertyName("filterSettings")] + [Key("filterSettings")] + public System.Text.Json.JsonElement? FilterSettings { get; init; } + + /// + /// Name of the source the filter was added to + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SourceFilterCreatedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceFilterCreatedPayload(double filterIndex, string? sourceName = null, string? filterName = null, string? filterKind = null, System.Text.Json.JsonElement? filterSettings = null, System.Text.Json.JsonElement? defaultFilterSettings = null) + { + this.SourceName = sourceName; + this.FilterName = filterName; + this.FilterKind = filterKind; + this.FilterIndex = filterIndex; + this.FilterSettings = filterSettings; + this.DefaultFilterSettings = defaultFilterSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterEnableStateChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterEnableStateChanged.EventPayload.g.cs new file mode 100644 index 0000000..d78a96e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterEnableStateChanged.EventPayload.g.cs @@ -0,0 +1,66 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SourceFilterEnableStateChanged event. +/// +/// +/// A source filter's enable state has changed. +/// Requires Subscription: Filters | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SourceFilterEnableStateChangedPayload +{ + /// + /// Whether the filter is enabled + /// + [JsonPropertyName("filterEnabled")] + [Key("filterEnabled")] + public required bool FilterEnabled { get; init; } + + /// + /// Name of the filter + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public string? FilterName { get; init; } + + /// + /// Name of the source the filter is on + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SourceFilterEnableStateChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SourceFilterEnableStateChangedPayload(bool filterEnabled, string? sourceName = null, string? filterName = null) + { + this.SourceName = sourceName; + this.FilterName = filterName; + this.FilterEnabled = filterEnabled; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterListReindexed.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterListReindexed.EventPayload.g.cs new file mode 100644 index 0000000..7e2ce55 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterListReindexed.EventPayload.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SourceFilterListReindexed event. +/// +/// +/// A source's filter list has been reindexed. +/// Requires Subscription: Filters | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SourceFilterListReindexedPayload +{ + /// + /// Array of filter objects + /// + [JsonPropertyName("filters")] + [Key("filters")] + public System.Collections.Generic.List? Filters { get; init; } + + /// + /// Name of the source + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SourceFilterListReindexedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SourceFilterListReindexedPayload(string? sourceName = null, System.Collections.Generic.List? filters = null) + { + this.SourceName = sourceName; + this.Filters = filters; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterNameChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterNameChanged.EventPayload.g.cs new file mode 100644 index 0000000..d561018 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterNameChanged.EventPayload.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SourceFilterNameChanged event. +/// +/// +/// The name of a source filter has changed. +/// Requires Subscription: Filters | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SourceFilterNameChangedPayload +{ + /// + /// New name of the filter + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public string? FilterName { get; init; } + + /// + /// Old name of the filter + /// + [JsonPropertyName("oldFilterName")] + [Key("oldFilterName")] + public string? OldFilterName { get; init; } + + /// + /// The source the filter is on + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SourceFilterNameChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SourceFilterNameChangedPayload(string? sourceName = null, string? oldFilterName = null, string? filterName = null) + { + this.SourceName = sourceName; + this.OldFilterName = oldFilterName; + this.FilterName = filterName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterRemoved.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterRemoved.EventPayload.g.cs new file mode 100644 index 0000000..a4a9aa1 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterRemoved.EventPayload.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SourceFilterRemoved event. +/// +/// +/// A filter has been removed from a source. +/// Requires Subscription: Filters | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SourceFilterRemovedPayload +{ + /// + /// Name of the filter + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public string? FilterName { get; init; } + + /// + /// Name of the source the filter was on + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SourceFilterRemovedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SourceFilterRemovedPayload(string? sourceName = null, string? filterName = null) + { + this.SourceName = sourceName; + this.FilterName = filterName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterSettingsChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterSettingsChanged.EventPayload.g.cs new file mode 100644 index 0000000..7d4bb98 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/SourceFilterSettingsChanged.EventPayload.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the SourceFilterSettingsChanged event. +/// +/// +/// An source filter's settings have changed (been updated). +/// Requires Subscription: Filters | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.4.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SourceFilterSettingsChangedPayload +{ + /// + /// Name of the filter + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public string? FilterName { get; init; } + + /// + /// New settings object of the filter + /// + [JsonPropertyName("filterSettings")] + [Key("filterSettings")] + public System.Text.Json.JsonElement? FilterSettings { get; init; } + + /// + /// Name of the source the filter is on + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SourceFilterSettingsChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SourceFilterSettingsChangedPayload(string? sourceName = null, string? filterName = null, System.Text.Json.JsonElement? filterSettings = null) + { + this.SourceName = sourceName; + this.FilterName = filterName; + this.FilterSettings = filterSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/StreamStateChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/StreamStateChanged.EventPayload.g.cs new file mode 100644 index 0000000..6200c07 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/StreamStateChanged.EventPayload.g.cs @@ -0,0 +1,58 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the StreamStateChanged event. +/// +/// +/// The state of the stream output has changed. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record StreamStateChangedPayload +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// + /// The specific state of the output + /// + [JsonPropertyName("outputState")] + [Key("outputState")] + public string? OutputState { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public StreamStateChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StreamStateChangedPayload(bool outputActive, string? outputState = null) + { + this.OutputActive = outputActive; + this.OutputState = outputState; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/StudioModeStateChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/StudioModeStateChanged.EventPayload.g.cs new file mode 100644 index 0000000..d50029e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/StudioModeStateChanged.EventPayload.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the StudioModeStateChanged event. +/// +/// +/// Studio mode has been enabled or disabled. +/// Requires Subscription: Ui | Complexity: 1 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record StudioModeStateChangedPayload +{ + /// + /// True == Enabled, False == Disabled + /// + [JsonPropertyName("studioModeEnabled")] + [Key("studioModeEnabled")] + public required bool StudioModeEnabled { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public StudioModeStateChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StudioModeStateChangedPayload(bool studioModeEnabled) + { + this.StudioModeEnabled = studioModeEnabled; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/VendorEvent.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/VendorEvent.EventPayload.g.cs new file mode 100644 index 0000000..5ca8346 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/VendorEvent.EventPayload.g.cs @@ -0,0 +1,68 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the VendorEvent event. +/// +/// +/// An event has been emitted from a vendor. +/// +/// A vendor is a unique name registered by a third-party plugin or script, which allows for custom requests and events to be added to obs-websocket. +/// If a plugin or script implements vendor requests or events, documentation is expected to be provided with them. +/// Requires Subscription: Vendors | Complexity: 3 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record VendorEventPayload +{ + /// + /// Vendor-provided event data. {} if event does not provide any data + /// + [JsonPropertyName("eventData")] + [Key("eventData")] + public System.Text.Json.JsonElement? EventData { get; init; } + + /// + /// Vendor-provided event typedef + /// + [JsonPropertyName("eventType")] + [Key("eventType")] + public string? EventType { get; init; } + + /// + /// Name of the vendor emitting the event + /// + [JsonPropertyName("vendorName")] + [Key("vendorName")] + public string? VendorName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public VendorEventPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public VendorEventPayload(string? vendorName = null, string? eventType = null, System.Text.Json.JsonElement? eventData = null) + { + this.VendorName = vendorName; + this.EventType = eventType; + this.EventData = eventData; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Events/VirtualcamStateChanged.EventPayload.g.cs b/ObsWebSocket.Core/Generated/Protocol/Events/VirtualcamStateChanged.EventPayload.g.cs new file mode 100644 index 0000000..b92b4f9 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Events/VirtualcamStateChanged.EventPayload.g.cs @@ -0,0 +1,58 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Events; + +/// +/// Data payload for the VirtualcamStateChanged event. +/// +/// +/// The state of the virtualcam output has changed. +/// Requires Subscription: Outputs | Complexity: 2 +/// RPC Version: 1 | Initial Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record VirtualcamStateChangedPayload +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// + /// The specific state of the output + /// + [JsonPropertyName("outputState")] + [Key("outputState")] + public string? OutputState { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public VirtualcamStateChangedPayload() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VirtualcamStateChangedPayload(bool outputActive, string? outputState = null) + { + this.OutputActive = outputActive; + this.OutputState = outputState; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Generated/EventSubscription.Enum.g.cs b/ObsWebSocket.Core/Generated/Protocol/Generated/EventSubscription.Enum.g.cs new file mode 100644 index 0000000..9b22d8b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Generated/EventSubscription.Enum.g.cs @@ -0,0 +1,167 @@ +// +// Type: Numeric Enum (int) +#nullable enable + +namespace ObsWebSocket.Core.Protocol.Generated; + +/// +/// Represents the EventSubscription options defined in the OBS WebSocket protocol. +/// +/// Generated from OBS WebSocket Protocol definition. +[System.Flags] +public enum EventSubscription : int +{ + /// + /// Subcription value used to disable all events. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + None = 0, + + /// + /// Subscription value to receive events in the `General` category. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + General = (1 << 0), + + /// + /// Subscription value to receive events in the `Config` category. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Config = (1 << 1), + + /// + /// Subscription value to receive events in the `Scenes` category. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Scenes = (1 << 2), + + /// + /// Subscription value to receive events in the `Inputs` category. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Inputs = (1 << 3), + + /// + /// Subscription value to receive events in the `Transitions` category. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Transitions = (1 << 4), + + /// + /// Subscription value to receive events in the `Filters` category. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Filters = (1 << 5), + + /// + /// Subscription value to receive events in the `Outputs` category. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Outputs = (1 << 6), + + /// + /// Subscription value to receive events in the `SceneItems` category. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + SceneItems = (1 << 7), + + /// + /// Subscription value to receive events in the `MediaInputs` category. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + MediaInputs = (1 << 8), + + /// + /// Subscription value to receive the `VendorEvent` event. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Vendors = (1 << 9), + + /// + /// Subscription value to receive events in the `Ui` category. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Ui = (1 << 10), + + /// + /// Helper to receive all non-high-volume events. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + All = (General | Config | Scenes | Inputs | Transitions | Filters | Outputs | SceneItems | MediaInputs | Vendors | Ui), + + /// + /// Subscription value to receive the `InputVolumeMeters` high-volume event. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + InputVolumeMeters = (1 << 16), + + /// + /// Subscription value to receive the `InputActiveStateChanged` high-volume event. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + InputActiveStateChanged = (1 << 17), + + /// + /// Subscription value to receive the `InputShowStateChanged` high-volume event. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + InputShowStateChanged = (1 << 18), + + /// + /// Subscription value to receive the `SceneItemTransformChanged` high-volume event. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + SceneItemTransformChanged = (1 << 19), + +} diff --git a/ObsWebSocket.Core/Generated/Protocol/Generated/ObsMediaInputAction.Class.g.cs b/ObsWebSocket.Core/Generated/Protocol/Generated/ObsMediaInputAction.Class.g.cs new file mode 100644 index 0000000..0931734 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Generated/ObsMediaInputAction.Class.g.cs @@ -0,0 +1,83 @@ +// +// Type: String-Constant Class +#nullable enable + +namespace ObsWebSocket.Core.Protocol.Generated; + +/// +/// Contains string constants representing the ObsMediaInputAction options defined in the OBS WebSocket protocol. +/// +/// Generated from OBS WebSocket Protocol definition. +public static class ObsMediaInputAction +{ + /// + /// No action. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NONE" + /// + public static readonly string OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NONE = "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NONE"; + + /// + /// Play the media input. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PLAY" + /// + public static readonly string OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PLAY = "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PLAY"; + + /// + /// Pause the media input. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PAUSE" + /// + public static readonly string OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PAUSE = "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PAUSE"; + + /// + /// Stop the media input. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP" + /// + public static readonly string OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP = "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP"; + + /// + /// Restart the media input. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART" + /// + public static readonly string OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART = "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART"; + + /// + /// Go to the next playlist item. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NEXT" + /// + public static readonly string OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NEXT = "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NEXT"; + + /// + /// Go to the previous playlist item. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PREVIOUS" + /// + public static readonly string OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PREVIOUS = "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PREVIOUS"; + +} diff --git a/ObsWebSocket.Core/Generated/Protocol/Generated/ObsOutputState.Class.g.cs b/ObsWebSocket.Core/Generated/Protocol/Generated/ObsOutputState.Class.g.cs new file mode 100644 index 0000000..d30326b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Generated/ObsOutputState.Class.g.cs @@ -0,0 +1,103 @@ +// +// Type: String-Constant Class +#nullable enable + +namespace ObsWebSocket.Core.Protocol.Generated; + +/// +/// Contains string constants representing the ObsOutputState options defined in the OBS WebSocket protocol. +/// +/// Generated from OBS WebSocket Protocol definition. +public static class ObsOutputState +{ + /// + /// Unknown state. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_OUTPUT_UNKNOWN" + /// + public static readonly string OBS_WEBSOCKET_OUTPUT_UNKNOWN = "OBS_WEBSOCKET_OUTPUT_UNKNOWN"; + + /// + /// The output is starting. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_OUTPUT_STARTING" + /// + public static readonly string OBS_WEBSOCKET_OUTPUT_STARTING = "OBS_WEBSOCKET_OUTPUT_STARTING"; + + /// + /// The input has started. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_OUTPUT_STARTED" + /// + public static readonly string OBS_WEBSOCKET_OUTPUT_STARTED = "OBS_WEBSOCKET_OUTPUT_STARTED"; + + /// + /// The output is stopping. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_OUTPUT_STOPPING" + /// + public static readonly string OBS_WEBSOCKET_OUTPUT_STOPPING = "OBS_WEBSOCKET_OUTPUT_STOPPING"; + + /// + /// The output has stopped. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_OUTPUT_STOPPED" + /// + public static readonly string OBS_WEBSOCKET_OUTPUT_STOPPED = "OBS_WEBSOCKET_OUTPUT_STOPPED"; + + /// + /// The output has disconnected and is reconnecting. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_OUTPUT_RECONNECTING" + /// + public static readonly string OBS_WEBSOCKET_OUTPUT_RECONNECTING = "OBS_WEBSOCKET_OUTPUT_RECONNECTING"; + + /// + /// The output has reconnected successfully. + /// + /// + /// Initial OBS Websocket Version: 5.1.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_OUTPUT_RECONNECTED" + /// + public static readonly string OBS_WEBSOCKET_OUTPUT_RECONNECTED = "OBS_WEBSOCKET_OUTPUT_RECONNECTED"; + + /// + /// The output is now paused. + /// + /// + /// Initial OBS Websocket Version: 5.1.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_OUTPUT_PAUSED" + /// + public static readonly string OBS_WEBSOCKET_OUTPUT_PAUSED = "OBS_WEBSOCKET_OUTPUT_PAUSED"; + + /// + /// The output has been resumed (unpaused). + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// Value: "OBS_WEBSOCKET_OUTPUT_RESUMED" + /// + public static readonly string OBS_WEBSOCKET_OUTPUT_RESUMED = "OBS_WEBSOCKET_OUTPUT_RESUMED"; + +} diff --git a/ObsWebSocket.Core/Generated/Protocol/Generated/RequestBatchExecutionType.Enum.g.cs b/ObsWebSocket.Core/Generated/Protocol/Generated/RequestBatchExecutionType.Enum.g.cs new file mode 100644 index 0000000..ab08ad2 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Generated/RequestBatchExecutionType.Enum.g.cs @@ -0,0 +1,56 @@ +// +// Type: Numeric Enum (int) +#nullable enable + +namespace ObsWebSocket.Core.Protocol.Generated; + +/// +/// Represents the RequestBatchExecutionType options defined in the OBS WebSocket protocol. +/// +/// Generated from OBS WebSocket Protocol definition. +public enum RequestBatchExecutionType : int +{ + /// + /// Not a request batch. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + None = -1, + + /// + /// A request batch which processes all requests serially, as fast as possible. + /// + /// Note: To introduce artificial delay, use the `Sleep` request and the `sleepMillis` request field. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + SerialRealtime = 0, + + /// + /// A request batch type which processes all requests serially, in sync with the graphics thread. Designed to provide high accuracy for animations. + /// + /// Note: To introduce artificial delay, use the `Sleep` request and the `sleepFrames` request field. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + SerialFrame = 1, + + /// + /// A request batch type which processes all requests using all available threads in the thread pool. + /// + /// Note: This is mainly experimental, and only really shows its colors during requests which require lots of + /// active processing, like `GetSourceScreenshot`. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Parallel = 2, + +} diff --git a/ObsWebSocket.Core/Generated/Protocol/Generated/RequestStatus.Enum.g.cs b/ObsWebSocket.Core/Generated/Protocol/Generated/RequestStatus.Enum.g.cs new file mode 100644 index 0000000..83ede42 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Generated/RequestStatus.Enum.g.cs @@ -0,0 +1,331 @@ +// +// Type: Numeric Enum (int) +#nullable enable + +namespace ObsWebSocket.Core.Protocol.Generated; + +/// +/// Represents the RequestStatus options defined in the OBS WebSocket protocol. +/// +/// Generated from OBS WebSocket Protocol definition. +public enum RequestStatus : int +{ + /// + /// Unknown status, should never be used. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Unknown = 0, + + /// + /// For internal use to signify a successful field check. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + NoError = 10, + + /// + /// The request has succeeded. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Success = 100, + + /// + /// The `requestType` field is missing from the request data. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + MissingRequestType = 203, + + /// + /// The request type is invalid or does not exist. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + UnknownRequestType = 204, + + /// + /// Generic error code. + /// + /// Note: A comment is required to be provided by obs-websocket. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + GenericError = 205, + + /// + /// The request batch execution type is not supported. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + UnsupportedRequestBatchExecutionType = 206, + + /// + /// The server is not ready to handle the request. + /// + /// Note: This usually occurs during OBS scene collection change or exit. Requests may be tried again after a delay if this code is given. + /// + /// + /// Initial OBS Websocket Version: 5.3.0 + /// RPC Version: 1 + /// + NotReady = 207, + + /// + /// A required request field is missing. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + MissingRequestField = 300, + + /// + /// The request does not have a valid requestData object. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + MissingRequestData = 301, + + /// + /// Generic invalid request field message. + /// + /// Note: A comment is required to be provided by obs-websocket. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + InvalidRequestField = 400, + + /// + /// A request field has the wrong data type. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + InvalidRequestFieldType = 401, + + /// + /// A request field (number) is outside of the allowed range. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + RequestFieldOutOfRange = 402, + + /// + /// A request field (string or array) is empty and cannot be. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + RequestFieldEmpty = 403, + + /// + /// There are too many request fields (eg. a request takes two optionals, where only one is allowed at a time). + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + TooManyRequestFields = 404, + + /// + /// An output is running and cannot be in order to perform the request. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + OutputRunning = 500, + + /// + /// An output is not running and should be. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + OutputNotRunning = 501, + + /// + /// An output is paused and should not be. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + OutputPaused = 502, + + /// + /// An output is not paused and should be. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + OutputNotPaused = 503, + + /// + /// An output is disabled and should not be. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + OutputDisabled = 504, + + /// + /// Studio mode is active and cannot be. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + StudioModeActive = 505, + + /// + /// Studio mode is not active and should be. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + StudioModeNotActive = 506, + + /// + /// The resource was not found. + /// + /// Note: Resources are any kind of object in obs-websocket, like inputs, profiles, outputs, etc. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + ResourceNotFound = 600, + + /// + /// The resource already exists. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + ResourceAlreadyExists = 601, + + /// + /// The type of resource found is invalid. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + InvalidResourceType = 602, + + /// + /// There are not enough instances of the resource in order to perform the request. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + NotEnoughResources = 603, + + /// + /// The state of the resource is invalid. For example, if the resource is blocked from being accessed. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + InvalidResourceState = 604, + + /// + /// The specified input (obs_source_t-OBS_SOURCE_TYPE_INPUT) had the wrong kind. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + InvalidInputKind = 605, + + /// + /// The resource does not support being configured. + /// + /// This is particularly relevant to transitions, where they do not always have changeable settings. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + ResourceNotConfigurable = 606, + + /// + /// The specified filter (obs_source_t-OBS_SOURCE_TYPE_FILTER) had the wrong kind. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + InvalidFilterKind = 607, + + /// + /// Creating the resource failed. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + ResourceCreationFailed = 700, + + /// + /// Performing an action on the resource failed. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + ResourceActionFailed = 701, + + /// + /// Processing the request failed unexpectedly. + /// + /// Note: A comment is required to be provided by obs-websocket. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + RequestProcessingFailed = 702, + + /// + /// The combination of request fields cannot be used to perform an action. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + CannotAct = 703, + +} diff --git a/ObsWebSocket.Core/Generated/Protocol/Generated/WebSocketCloseCode.Enum.g.cs b/ObsWebSocket.Core/Generated/Protocol/Generated/WebSocketCloseCode.Enum.g.cs new file mode 100644 index 0000000..b7a2f02 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Generated/WebSocketCloseCode.Enum.g.cs @@ -0,0 +1,134 @@ +// +// Type: Numeric Enum (int) +#nullable enable + +namespace ObsWebSocket.Core.Protocol.Generated; + +/// +/// Represents the WebSocketCloseCode options defined in the OBS WebSocket protocol. +/// +/// Generated from OBS WebSocket Protocol definition. +public enum WebSocketCloseCode : int +{ + /// + /// For internal use only to tell the request handler not to perform any close action. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + DontClose = 0, + + /// + /// Unknown reason, should never be used. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + UnknownReason = 4000, + + /// + /// The server was unable to decode the incoming websocket message. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + MessageDecodeError = 4002, + + /// + /// A data field is required but missing from the payload. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + MissingDataField = 4003, + + /// + /// A data field's value type is invalid. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + InvalidDataFieldType = 4004, + + /// + /// A data field's value is invalid. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + InvalidDataFieldValue = 4005, + + /// + /// The specified `op` was invalid or missing. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + UnknownOpCode = 4006, + + /// + /// The client sent a websocket message without first sending `Identify` message. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + NotIdentified = 4007, + + /// + /// The client sent an `Identify` message while already identified. + /// + /// Note: Once a client has identified, only `Reidentify` may be used to change session parameters. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + AlreadyIdentified = 4008, + + /// + /// The authentication attempt (via `Identify`) failed. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + AuthenticationFailed = 4009, + + /// + /// The server detected the usage of an old version of the obs-websocket RPC protocol. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + UnsupportedRpcVersion = 4010, + + /// + /// The websocket session has been invalidated by the obs-websocket server. + /// + /// Note: This is the code used by the `Kick` button in the UI Session List. If you receive this code, you must not automatically reconnect. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + SessionInvalidated = 4011, + + /// + /// A requested feature is not supported due to hardware/software limitations. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + UnsupportedFeature = 4012, + +} diff --git a/ObsWebSocket.Core/Generated/Protocol/Generated/WebSocketOpCode.Enum.g.cs b/ObsWebSocket.Core/Generated/Protocol/Generated/WebSocketOpCode.Enum.g.cs new file mode 100644 index 0000000..1a57592 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Generated/WebSocketOpCode.Enum.g.cs @@ -0,0 +1,94 @@ +// +// Type: Numeric Enum (byte) +#nullable enable + +namespace ObsWebSocket.Core.Protocol.Generated; + +/// +/// Represents the WebSocketOpCode options defined in the OBS WebSocket protocol. +/// +/// Generated from OBS WebSocket Protocol definition. +public enum WebSocketOpCode : byte +{ + /// + /// The initial message sent by obs-websocket to newly connected clients. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Hello = 0, + + /// + /// The message sent by a newly connected client to obs-websocket in response to a `Hello`. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Identify = 1, + + /// + /// The response sent by obs-websocket to a client after it has successfully identified with obs-websocket. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Identified = 2, + + /// + /// The message sent by an already-identified client to update identification parameters. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Reidentify = 3, + + /// + /// The message sent by obs-websocket containing an event payload. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Event = 5, + + /// + /// The message sent by a client to obs-websocket to perform a request. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + Request = 6, + + /// + /// The message sent by obs-websocket in response to a particular request from a client. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + RequestResponse = 7, + + /// + /// The message sent by a client to obs-websocket to perform a batch of requests. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + RequestBatch = 8, + + /// + /// The message sent by obs-websocket in response to a particular batch of requests from a client. + /// + /// + /// Initial OBS Websocket Version: 5.0.0 + /// RPC Version: 1 + /// + RequestBatchResponse = 9, + +} diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/BroadcastCustomEvent.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/BroadcastCustomEvent.Request.g.cs new file mode 100644 index 0000000..77b6175 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/BroadcastCustomEvent.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the BroadcastCustomEvent request. +/// +/// +/// Broadcasts a `CustomEvent` to all WebSocket clients. Receivers are clients which are identified and subscribed. +/// OBS WebSocket Protocol Category: general | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record BroadcastCustomEventRequestData +{ + /// + /// Data payload to emit to all receivers + /// + /// + /// Optional: false + /// + [JsonPropertyName("eventData")] + [Key("eventData")] + public required System.Text.Json.JsonElement? EventData { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public BroadcastCustomEventRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public BroadcastCustomEventRequestData(System.Text.Json.JsonElement? eventData) + { + this.EventData = eventData; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/CallVendorRequest.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/CallVendorRequest.Request.g.cs new file mode 100644 index 0000000..b7ec4f8 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/CallVendorRequest.Request.g.cs @@ -0,0 +1,79 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the CallVendorRequest request. +/// +/// +/// Call a request registered to a vendor. +/// +/// A vendor is a unique name registered by a third-party plugin or script, which allows for custom requests and events to be added to obs-websocket. +/// If a plugin or script implements vendor requests or events, documentation is expected to be provided with them. +/// OBS WebSocket Protocol Category: general | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CallVendorRequestRequestData +{ + /// + /// Object containing appropriate request data + /// + /// + /// Optional: true + /// Behavior When Optional: {} + /// + [JsonPropertyName("requestData")] + [Key("requestData")] + public System.Text.Json.JsonElement? RequestData { get; init; } + + /// + /// The request type to call + /// + /// + /// Optional: false + /// + [JsonPropertyName("requestType")] + [Key("requestType")] + public required string RequestType { get; init; } + + /// + /// Name of the vendor to use + /// + /// + /// Optional: false + /// + [JsonPropertyName("vendorName")] + [Key("vendorName")] + public required string VendorName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CallVendorRequestRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CallVendorRequestRequestData(string vendorName, string requestType, System.Text.Json.JsonElement? requestData = null) + { + this.VendorName = vendorName; + this.RequestType = requestType; + this.RequestData = requestData; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/CreateInput.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateInput.Request.g.cs new file mode 100644 index 0000000..ab4d8d0 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateInput.Request.g.cs @@ -0,0 +1,112 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the CreateInput request. +/// +/// +/// Creates a new input, adding it as a scene item to the specified scene. +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CreateInputRequestData +{ + /// + /// The kind of input to be created + /// + /// + /// Optional: false + /// + [JsonPropertyName("inputKind")] + [Key("inputKind")] + public required string InputKind { get; init; } + + /// + /// Name of the new input to created + /// + /// + /// Optional: false + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public required string InputName { get; init; } + + /// + /// Settings object to initialize the input with + /// + /// + /// Optional: true + /// Behavior When Optional: Default settings used + /// + [JsonPropertyName("inputSettings")] + [Key("inputSettings")] + public System.Text.Json.JsonElement? InputSettings { get; init; } + + /// + /// Whether to set the created scene item to enabled or disabled + /// + /// + /// Optional: true + /// Behavior When Optional: True + /// + [JsonPropertyName("sceneItemEnabled")] + [Key("sceneItemEnabled")] + public bool? SceneItemEnabled { get; init; } + + /// + /// Name of the scene to add the input to as a scene item + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene to add the input to as a scene item + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CreateInputRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateInputRequestData(string inputName, string inputKind, string? sceneName = null, string? sceneUuid = null, System.Text.Json.JsonElement? inputSettings = null, bool? sceneItemEnabled = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.InputName = inputName; + this.InputKind = inputKind; + this.InputSettings = inputSettings; + this.SceneItemEnabled = sceneItemEnabled; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/CreateProfile.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateProfile.Request.g.cs new file mode 100644 index 0000000..8e0e297 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateProfile.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the CreateProfile request. +/// +/// +/// Creates a new profile, switching to it in the process +/// OBS WebSocket Protocol Category: config | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CreateProfileRequestData +{ + /// + /// Name for the new profile + /// + /// + /// Optional: false + /// + [JsonPropertyName("profileName")] + [Key("profileName")] + public required string ProfileName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CreateProfileRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateProfileRequestData(string profileName) + { + this.ProfileName = profileName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/CreateRecordChapter.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateRecordChapter.Request.g.cs new file mode 100644 index 0000000..e2e3e73 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateRecordChapter.Request.g.cs @@ -0,0 +1,55 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the CreateRecordChapter request. +/// +/// +/// Adds a new chapter marker to the file currently being recorded. +/// +/// Note: As of OBS 30.2.0, the only file format supporting this feature is Hybrid MP4. +/// OBS WebSocket Protocol Category: record | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.5.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CreateRecordChapterRequestData +{ + /// + /// Name of the new chapter + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("chapterName")] + [Key("chapterName")] + public string? ChapterName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CreateRecordChapterRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CreateRecordChapterRequestData(string? chapterName = null) + { + this.ChapterName = chapterName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/CreateScene.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateScene.Request.g.cs new file mode 100644 index 0000000..57861f4 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateScene.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the CreateScene request. +/// +/// +/// Creates a new scene in OBS. +/// OBS WebSocket Protocol Category: scenes | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CreateSceneRequestData +{ + /// + /// Name for the new scene + /// + /// + /// Optional: false + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public required string SceneName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CreateSceneRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateSceneRequestData(string sceneName) + { + this.SceneName = sceneName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/CreateSceneCollection.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateSceneCollection.Request.g.cs new file mode 100644 index 0000000..1b5ca6f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateSceneCollection.Request.g.cs @@ -0,0 +1,55 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the CreateSceneCollection request. +/// +/// +/// Creates a new scene collection, switching to it in the process. +/// +/// Note: This will block until the collection has finished changing. +/// OBS WebSocket Protocol Category: config | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CreateSceneCollectionRequestData +{ + /// + /// Name for the new scene collection + /// + /// + /// Optional: false + /// + [JsonPropertyName("sceneCollectionName")] + [Key("sceneCollectionName")] + public required string SceneCollectionName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CreateSceneCollectionRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateSceneCollectionRequestData(string sceneCollectionName) + { + this.SceneCollectionName = sceneCollectionName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/CreateSceneItem.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateSceneItem.Request.g.cs new file mode 100644 index 0000000..86b4902 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateSceneItem.Request.g.cs @@ -0,0 +1,103 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the CreateSceneItem request. +/// +/// +/// Creates a new scene item using a source. +/// +/// Scenes only +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CreateSceneItemRequestData +{ + /// + /// Enable state to apply to the scene item on creation + /// + /// + /// Optional: true + /// Behavior When Optional: True + /// + [JsonPropertyName("sceneItemEnabled")] + [Key("sceneItemEnabled")] + public bool? SceneItemEnabled { get; init; } + + /// + /// Name of the scene to create the new item in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene to create the new item in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// + /// Name of the source to add to the scene + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source to add to the scene + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CreateSceneItemRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CreateSceneItemRequestData(string? sceneName = null, string? sceneUuid = null, string? sourceName = null, string? sourceUuid = null, bool? sceneItemEnabled = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.SceneItemEnabled = sceneItemEnabled; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/CreateSourceFilter.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateSourceFilter.Request.g.cs new file mode 100644 index 0000000..1c85e7d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/CreateSourceFilter.Request.g.cs @@ -0,0 +1,100 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the CreateSourceFilter request. +/// +/// +/// Creates a new filter, adding it to the specified source. +/// OBS WebSocket Protocol Category: filters | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CreateSourceFilterRequestData +{ + /// + /// The kind of filter to be created + /// + /// + /// Optional: false + /// + [JsonPropertyName("filterKind")] + [Key("filterKind")] + public required string FilterKind { get; init; } + + /// + /// Name of the new filter to be created + /// + /// + /// Optional: false + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public required string FilterName { get; init; } + + /// + /// Settings object to initialize the filter with + /// + /// + /// Optional: true + /// Behavior When Optional: Default settings used + /// + [JsonPropertyName("filterSettings")] + [Key("filterSettings")] + public System.Text.Json.JsonElement? FilterSettings { get; init; } + + /// + /// Name of the source to add the filter to + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source to add the filter to + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CreateSourceFilterRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateSourceFilterRequestData(string filterName, string filterKind, string? sourceName = null, string? sourceUuid = null, System.Text.Json.JsonElement? filterSettings = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.FilterName = filterName; + this.FilterKind = filterKind; + this.FilterSettings = filterSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/DuplicateSceneItem.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/DuplicateSceneItem.Request.g.cs new file mode 100644 index 0000000..2ce8d81 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/DuplicateSceneItem.Request.g.cs @@ -0,0 +1,104 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the DuplicateSceneItem request. +/// +/// +/// Duplicates a scene item, copying all transform and crop info. +/// +/// Scenes only +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record DuplicateSceneItemRequestData +{ + /// + /// Name of the scene to create the duplicated item in + /// + /// + /// Optional: true + /// Behavior When Optional: From scene is assumed + /// + [JsonPropertyName("destinationSceneName")] + [Key("destinationSceneName")] + public string? DestinationSceneName { get; init; } + + /// + /// UUID of the scene to create the duplicated item in + /// + /// + /// Optional: true + /// Behavior When Optional: From scene is assumed + /// + [JsonPropertyName("destinationSceneUuid")] + [Key("destinationSceneUuid")] + public string? DestinationSceneUuid { get; init; } + + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public DuplicateSceneItemRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DuplicateSceneItemRequestData(double sceneItemId, string? sceneName = null, string? sceneUuid = null, string? destinationSceneName = null, string? destinationSceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + this.DestinationSceneName = destinationSceneName; + this.DestinationSceneUuid = destinationSceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetGroupSceneItemList.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetGroupSceneItemList.Request.g.cs new file mode 100644 index 0000000..80be5e9 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetGroupSceneItemList.Request.g.cs @@ -0,0 +1,69 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetGroupSceneItemList request. +/// +/// +/// Basically GetSceneItemList, but for groups. +/// +/// Using groups at all in OBS is discouraged, as they are very broken under the hood. Please use nested scenes instead. +/// +/// Groups only +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetGroupSceneItemListRequestData +{ + /// + /// Name of the group to get the items of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the group to get the items of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetGroupSceneItemListRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetGroupSceneItemListRequestData(string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioBalance.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioBalance.Request.g.cs new file mode 100644 index 0000000..44a090f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioBalance.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputAudioBalance request. +/// +/// +/// Gets the audio balance of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputAudioBalanceRequestData +{ + /// + /// Name of the input to get the audio balance of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to get the audio balance of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputAudioBalanceRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputAudioBalanceRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioMonitorType.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioMonitorType.Request.g.cs new file mode 100644 index 0000000..9d0dc3a --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioMonitorType.Request.g.cs @@ -0,0 +1,71 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputAudioMonitorType request. +/// +/// +/// Gets the audio monitor type of an input. +/// +/// The available audio monitor types are: +/// +/// - `OBS_MONITORING_TYPE_NONE` +/// - `OBS_MONITORING_TYPE_MONITOR_ONLY` +/// - `OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT` +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputAudioMonitorTypeRequestData +{ + /// + /// Name of the input to get the audio monitor type of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to get the audio monitor type of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputAudioMonitorTypeRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputAudioMonitorTypeRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioSyncOffset.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioSyncOffset.Request.g.cs new file mode 100644 index 0000000..1f76b12 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioSyncOffset.Request.g.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputAudioSyncOffset request. +/// +/// +/// Gets the audio sync offset of an input. +/// +/// Note: The audio sync offset can be negative too! +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputAudioSyncOffsetRequestData +{ + /// + /// Name of the input to get the audio sync offset of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to get the audio sync offset of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputAudioSyncOffsetRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputAudioSyncOffsetRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioTracks.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioTracks.Request.g.cs new file mode 100644 index 0000000..8f8b7e8 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputAudioTracks.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputAudioTracks request. +/// +/// +/// Gets the enable state of all audio tracks of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputAudioTracksRequestData +{ + /// + /// Name of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputAudioTracksRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputAudioTracksRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputDefaultSettings.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputDefaultSettings.Request.g.cs new file mode 100644 index 0000000..6001d33 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputDefaultSettings.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputDefaultSettings request. +/// +/// +/// Gets the default settings for an input kind. +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputDefaultSettingsRequestData +{ + /// + /// Input kind to get the default settings for + /// + /// + /// Optional: false + /// + [JsonPropertyName("inputKind")] + [Key("inputKind")] + public required string InputKind { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputDefaultSettingsRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetInputDefaultSettingsRequestData(string inputKind) + { + this.InputKind = inputKind; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputDeinterlaceFieldOrder.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputDeinterlaceFieldOrder.Request.g.cs new file mode 100644 index 0000000..439431f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputDeinterlaceFieldOrder.Request.g.cs @@ -0,0 +1,72 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputDeinterlaceFieldOrder request. +/// +/// +/// Gets the deinterlace field order of an input. +/// +/// Deinterlace Field Orders: +/// +/// - `OBS_DEINTERLACE_FIELD_ORDER_TOP` +/// - `OBS_DEINTERLACE_FIELD_ORDER_BOTTOM` +/// +/// Note: Deinterlacing functionality is restricted to async inputs only. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.6.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputDeinterlaceFieldOrderRequestData +{ + /// + /// Name of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputDeinterlaceFieldOrderRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputDeinterlaceFieldOrderRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputDeinterlaceMode.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputDeinterlaceMode.Request.g.cs new file mode 100644 index 0000000..859e174 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputDeinterlaceMode.Request.g.cs @@ -0,0 +1,79 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputDeinterlaceMode request. +/// +/// +/// Gets the deinterlace mode of an input. +/// +/// Deinterlace Modes: +/// +/// - `OBS_DEINTERLACE_MODE_DISABLE` +/// - `OBS_DEINTERLACE_MODE_DISCARD` +/// - `OBS_DEINTERLACE_MODE_RETRO` +/// - `OBS_DEINTERLACE_MODE_BLEND` +/// - `OBS_DEINTERLACE_MODE_BLEND_2X` +/// - `OBS_DEINTERLACE_MODE_LINEAR` +/// - `OBS_DEINTERLACE_MODE_LINEAR_2X` +/// - `OBS_DEINTERLACE_MODE_YADIF` +/// - `OBS_DEINTERLACE_MODE_YADIF_2X` +/// +/// Note: Deinterlacing functionality is restricted to async inputs only. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.6.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputDeinterlaceModeRequestData +{ + /// + /// Name of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputDeinterlaceModeRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputDeinterlaceModeRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputKindList.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputKindList.Request.g.cs new file mode 100644 index 0000000..064a1ab --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputKindList.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputKindList request. +/// +/// +/// Gets an array of all available input kinds in OBS. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputKindListRequestData +{ + /// + /// True == Return all kinds as unversioned, False == Return with version suffixes (if available) + /// + /// + /// Optional: true + /// Behavior When Optional: false + /// + [JsonPropertyName("unversioned")] + [Key("unversioned")] + public bool? Unversioned { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputKindListRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputKindListRequestData(bool? unversioned = null) + { + this.Unversioned = unversioned; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputList.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputList.Request.g.cs new file mode 100644 index 0000000..764a282 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputList.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputList request. +/// +/// +/// Gets an array of all inputs in OBS. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputListRequestData +{ + /// + /// Restrict the array to only inputs of the specified kind + /// + /// + /// Optional: true + /// Behavior When Optional: All kinds included + /// + [JsonPropertyName("inputKind")] + [Key("inputKind")] + public string? InputKind { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputListRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputListRequestData(string? inputKind = null) + { + this.InputKind = inputKind; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputMute.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputMute.Request.g.cs new file mode 100644 index 0000000..6ebcf4f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputMute.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputMute request. +/// +/// +/// Gets the audio mute state of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputMuteRequestData +{ + /// + /// Name of input to get the mute state of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of input to get the mute state of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputMuteRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputMuteRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputPropertiesListPropertyItems.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputPropertiesListPropertyItems.Request.g.cs new file mode 100644 index 0000000..82ab546 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputPropertiesListPropertyItems.Request.g.cs @@ -0,0 +1,79 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputPropertiesListPropertyItems request. +/// +/// +/// Gets the items of a list property from an input's properties. +/// +/// Note: Use this in cases where an input provides a dynamic, selectable list of items. For example, display capture, where it provides a list of available displays. +/// OBS WebSocket Protocol Category: inputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputPropertiesListPropertyItemsRequestData +{ + /// + /// Name of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// Name of the list property to get the items of + /// + /// + /// Optional: false + /// + [JsonPropertyName("propertyName")] + [Key("propertyName")] + public required string PropertyName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputPropertiesListPropertyItemsRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetInputPropertiesListPropertyItemsRequestData(string propertyName, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.PropertyName = propertyName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputSettings.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputSettings.Request.g.cs new file mode 100644 index 0000000..1bb3b41 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputSettings.Request.g.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputSettings request. +/// +/// +/// Gets the settings of an input. +/// +/// Note: Does not include defaults. To create the entire settings object, overlay `inputSettings` over the `defaultInputSettings` provided by `GetInputDefaultSettings`. +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputSettingsRequestData +{ + /// + /// Name of the input to get the settings of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to get the settings of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputSettingsRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputSettingsRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputVolume.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputVolume.Request.g.cs new file mode 100644 index 0000000..dbc6bd7 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetInputVolume.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetInputVolume request. +/// +/// +/// Gets the current volume setting of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputVolumeRequestData +{ + /// + /// Name of the input to get the volume of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to get the volume of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputVolumeRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputVolumeRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetMediaInputStatus.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetMediaInputStatus.Request.g.cs new file mode 100644 index 0000000..30a11ad --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetMediaInputStatus.Request.g.cs @@ -0,0 +1,76 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetMediaInputStatus request. +/// +/// +/// Gets the status of a media input. +/// +/// Media States: +/// +/// - `OBS_MEDIA_STATE_NONE` +/// - `OBS_MEDIA_STATE_PLAYING` +/// - `OBS_MEDIA_STATE_OPENING` +/// - `OBS_MEDIA_STATE_BUFFERING` +/// - `OBS_MEDIA_STATE_PAUSED` +/// - `OBS_MEDIA_STATE_STOPPED` +/// - `OBS_MEDIA_STATE_ENDED` +/// - `OBS_MEDIA_STATE_ERROR` +/// OBS WebSocket Protocol Category: media inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetMediaInputStatusRequestData +{ + /// + /// Name of the media input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the media input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetMediaInputStatusRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetMediaInputStatusRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetOutputSettings.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetOutputSettings.Request.g.cs new file mode 100644 index 0000000..e5c0b73 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetOutputSettings.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetOutputSettings request. +/// +/// +/// Gets the settings of an output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetOutputSettingsRequestData +{ + /// + /// Output name + /// + /// + /// Optional: false + /// + [JsonPropertyName("outputName")] + [Key("outputName")] + public required string OutputName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetOutputSettingsRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetOutputSettingsRequestData(string outputName) + { + this.OutputName = outputName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetOutputStatus.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetOutputStatus.Request.g.cs new file mode 100644 index 0000000..6c6d57c --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetOutputStatus.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetOutputStatus request. +/// +/// +/// Gets the status of an output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetOutputStatusRequestData +{ + /// + /// Output name + /// + /// + /// Optional: false + /// + [JsonPropertyName("outputName")] + [Key("outputName")] + public required string OutputName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetOutputStatusRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetOutputStatusRequestData(string outputName) + { + this.OutputName = outputName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetPersistentData.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetPersistentData.Request.g.cs new file mode 100644 index 0000000..8fe90ea --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetPersistentData.Request.g.cs @@ -0,0 +1,64 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetPersistentData request. +/// +/// +/// Gets the value of a "slot" from the selected persistent data realm. +/// OBS WebSocket Protocol Category: config | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetPersistentDataRequestData +{ + /// + /// The data realm to select. `OBS_WEBSOCKET_DATA_REALM_GLOBAL` or `OBS_WEBSOCKET_DATA_REALM_PROFILE` + /// + /// + /// Optional: false + /// + [JsonPropertyName("realm")] + [Key("realm")] + public required string Realm { get; init; } + + /// + /// The name of the slot to retrieve data from + /// + /// + /// Optional: false + /// + [JsonPropertyName("slotName")] + [Key("slotName")] + public required string SlotName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetPersistentDataRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetPersistentDataRequestData(string realm, string slotName) + { + this.Realm = realm; + this.SlotName = slotName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetProfileParameter.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetProfileParameter.Request.g.cs new file mode 100644 index 0000000..6dd8a89 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetProfileParameter.Request.g.cs @@ -0,0 +1,64 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetProfileParameter request. +/// +/// +/// Gets a parameter from the current profile's configuration. +/// OBS WebSocket Protocol Category: config | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetProfileParameterRequestData +{ + /// + /// Category of the parameter to get + /// + /// + /// Optional: false + /// + [JsonPropertyName("parameterCategory")] + [Key("parameterCategory")] + public required string ParameterCategory { get; init; } + + /// + /// Name of the parameter to get + /// + /// + /// Optional: false + /// + [JsonPropertyName("parameterName")] + [Key("parameterName")] + public required string ParameterName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetProfileParameterRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetProfileParameterRequestData(string parameterCategory, string parameterName) + { + this.ParameterCategory = parameterCategory; + this.ParameterName = parameterName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemBlendMode.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemBlendMode.Request.g.cs new file mode 100644 index 0000000..058b992 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemBlendMode.Request.g.cs @@ -0,0 +1,90 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSceneItemBlendMode request. +/// +/// +/// Gets the blend mode of a scene item. +/// +/// Blend modes: +/// +/// - `OBS_BLEND_NORMAL` +/// - `OBS_BLEND_ADDITIVE` +/// - `OBS_BLEND_SUBTRACT` +/// - `OBS_BLEND_SCREEN` +/// - `OBS_BLEND_MULTIPLY` +/// - `OBS_BLEND_LIGHTEN` +/// - `OBS_BLEND_DARKEN` +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemBlendModeRequestData +{ + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemBlendModeRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneItemBlendModeRequestData(double sceneItemId, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemEnabled.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemEnabled.Request.g.cs new file mode 100644 index 0000000..c2c1487 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemEnabled.Request.g.cs @@ -0,0 +1,80 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSceneItemEnabled request. +/// +/// +/// Gets the enable state of a scene item. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemEnabledRequestData +{ + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemEnabledRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneItemEnabledRequestData(double sceneItemId, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemId.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemId.Request.g.cs new file mode 100644 index 0000000..a5d2edf --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemId.Request.g.cs @@ -0,0 +1,92 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSceneItemId request. +/// +/// +/// Searches a scene for a source, and returns its id. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemIdRequestData +{ + /// + /// Name of the scene or group to search in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene or group to search in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// + /// Number of matches to skip during search. >= 0 means first forward. -1 means last (top) item + /// + /// + /// Restrictions: >= -1 + /// Optional: true + /// Behavior When Optional: 0 + /// + [JsonPropertyName("searchOffset")] + [Key("searchOffset")] + public double? SearchOffset { get; init; } + + /// + /// Name of the source to find + /// + /// + /// Optional: false + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public required string SourceName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemIdRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneItemIdRequestData(string sourceName, string? sceneName = null, string? sceneUuid = null, double? searchOffset = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SourceName = sourceName; + this.SearchOffset = searchOffset; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemIndex.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemIndex.Request.g.cs new file mode 100644 index 0000000..42a2d51 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemIndex.Request.g.cs @@ -0,0 +1,82 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSceneItemIndex request. +/// +/// +/// Gets the index position of a scene item in a scene. +/// +/// An index of 0 is at the bottom of the source list in the UI. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemIndexRequestData +{ + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemIndexRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneItemIndexRequestData(double sceneItemId, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemList.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemList.Request.g.cs new file mode 100644 index 0000000..4203961 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemList.Request.g.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSceneItemList request. +/// +/// +/// Gets a list of all scene items in a scene. +/// +/// Scenes only +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemListRequestData +{ + /// + /// Name of the scene to get the items of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene to get the items of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemListRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSceneItemListRequestData(string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemLocked.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemLocked.Request.g.cs new file mode 100644 index 0000000..8dccea5 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemLocked.Request.g.cs @@ -0,0 +1,80 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSceneItemLocked request. +/// +/// +/// Gets the lock state of a scene item. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemLockedRequestData +{ + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemLockedRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneItemLockedRequestData(double sceneItemId, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemSource.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemSource.Request.g.cs new file mode 100644 index 0000000..5351a51 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemSource.Request.g.cs @@ -0,0 +1,78 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSceneItemSource request. +/// +/// +/// Gets the source associated with a scene item. +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.4.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemSourceRequestData +{ + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemSourceRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneItemSourceRequestData(double sceneItemId, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemTransform.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemTransform.Request.g.cs new file mode 100644 index 0000000..9b908bc --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneItemTransform.Request.g.cs @@ -0,0 +1,80 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSceneItemTransform request. +/// +/// +/// Gets the transform and crop info of a scene item. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemTransformRequestData +{ + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemTransformRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneItemTransformRequestData(double sceneItemId, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneSceneTransitionOverride.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneSceneTransitionOverride.Request.g.cs new file mode 100644 index 0000000..be7c625 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSceneSceneTransitionOverride.Request.g.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSceneSceneTransitionOverride request. +/// +/// +/// Gets the scene transition overridden for a scene. +/// +/// Note: A transition UUID response field is not currently able to be implemented as of 2024-1-18. +/// OBS WebSocket Protocol Category: scenes | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneSceneTransitionOverrideRequestData +{ + /// + /// Name of the scene + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneSceneTransitionOverrideRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSceneSceneTransitionOverrideRequestData(string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceActive.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceActive.Request.g.cs new file mode 100644 index 0000000..ed461e5 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceActive.Request.g.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSourceActive request. +/// +/// +/// Gets the active and show state of a source. +/// +/// **Compatible with inputs and scenes.** +/// OBS WebSocket Protocol Category: sources | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSourceActiveRequestData +{ + /// + /// Name of the source to get the active state of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source to get the active state of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSourceActiveRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSourceActiveRequestData(string? sourceName = null, string? sourceUuid = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceFilter.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceFilter.Request.g.cs new file mode 100644 index 0000000..afa7231 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceFilter.Request.g.cs @@ -0,0 +1,77 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSourceFilter request. +/// +/// +/// Gets the info for a specific source filter. +/// OBS WebSocket Protocol Category: filters | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSourceFilterRequestData +{ + /// + /// Name of the filter + /// + /// + /// Optional: false + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public required string FilterName { get; init; } + + /// + /// Name of the source + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSourceFilterRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSourceFilterRequestData(string filterName, string? sourceName = null, string? sourceUuid = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.FilterName = filterName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceFilterDefaultSettings.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceFilterDefaultSettings.Request.g.cs new file mode 100644 index 0000000..da3b79d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceFilterDefaultSettings.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSourceFilterDefaultSettings request. +/// +/// +/// Gets the default settings for a filter kind. +/// OBS WebSocket Protocol Category: filters | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSourceFilterDefaultSettingsRequestData +{ + /// + /// Filter kind to get the default settings for + /// + /// + /// Optional: false + /// + [JsonPropertyName("filterKind")] + [Key("filterKind")] + public required string FilterKind { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSourceFilterDefaultSettingsRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSourceFilterDefaultSettingsRequestData(string filterKind) + { + this.FilterKind = filterKind; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceFilterList.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceFilterList.Request.g.cs new file mode 100644 index 0000000..79ef285 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceFilterList.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSourceFilterList request. +/// +/// +/// Gets an array of all of a source's filters. +/// OBS WebSocket Protocol Category: filters | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSourceFilterListRequestData +{ + /// + /// Name of the source + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSourceFilterListRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSourceFilterListRequestData(string? sourceName = null, string? sourceUuid = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceScreenshot.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceScreenshot.Request.g.cs new file mode 100644 index 0000000..04fe61c --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/GetSourceScreenshot.Request.g.cs @@ -0,0 +1,121 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the GetSourceScreenshot request. +/// +/// +/// Gets a Base64-encoded screenshot of a source. +/// +/// The `imageWidth` and `imageHeight` parameters are treated as "scale to inner", meaning the smallest ratio will be used and the aspect ratio of the original resolution is kept. +/// If `imageWidth` and `imageHeight` are not specified, the compressed image will use the full resolution of the source. +/// +/// **Compatible with inputs and scenes.** +/// OBS WebSocket Protocol Category: sources | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSourceScreenshotRequestData +{ + /// + /// Compression quality to use. 0 for high compression, 100 for uncompressed. -1 to use "default" (whatever that means, idk) + /// + /// + /// Restrictions: >= -1, <= 100 + /// Optional: true + /// Behavior When Optional: -1 + /// + [JsonPropertyName("imageCompressionQuality")] + [Key("imageCompressionQuality")] + public double? ImageCompressionQuality { get; init; } + + /// + /// Image compression format to use. Use `GetVersion` to get compatible image formats + /// + /// + /// Optional: false + /// + [JsonPropertyName("imageFormat")] + [Key("imageFormat")] + public required string ImageFormat { get; init; } + + /// + /// Height to scale the screenshot to + /// + /// + /// Restrictions: >= 8, <= 4096 + /// Optional: true + /// Behavior When Optional: Source value is used + /// + [JsonPropertyName("imageHeight")] + [Key("imageHeight")] + public double? ImageHeight { get; init; } + + /// + /// Width to scale the screenshot to + /// + /// + /// Restrictions: >= 8, <= 4096 + /// Optional: true + /// Behavior When Optional: Source value is used + /// + [JsonPropertyName("imageWidth")] + [Key("imageWidth")] + public double? ImageWidth { get; init; } + + /// + /// Name of the source to take a screenshot of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source to take a screenshot of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSourceScreenshotRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSourceScreenshotRequestData(string imageFormat, string? sourceName = null, string? sourceUuid = null, double? imageWidth = null, double? imageHeight = null, double? imageCompressionQuality = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.ImageFormat = imageFormat; + this.ImageWidth = imageWidth; + this.ImageHeight = imageHeight; + this.ImageCompressionQuality = imageCompressionQuality; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/OffsetMediaInputCursor.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/OffsetMediaInputCursor.Request.g.cs new file mode 100644 index 0000000..e000f03 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/OffsetMediaInputCursor.Request.g.cs @@ -0,0 +1,79 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the OffsetMediaInputCursor request. +/// +/// +/// Offsets the current cursor position of a media input by the specified value. +/// +/// This request does not perform bounds checking of the cursor position. +/// OBS WebSocket Protocol Category: media inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record OffsetMediaInputCursorRequestData +{ + /// + /// Name of the media input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the media input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// Value to offset the current cursor position by + /// + /// + /// Optional: false + /// + [JsonPropertyName("mediaCursorOffset")] + [Key("mediaCursorOffset")] + public required double MediaCursorOffset { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public OffsetMediaInputCursorRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OffsetMediaInputCursorRequestData(double mediaCursorOffset, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.MediaCursorOffset = mediaCursorOffset; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/OpenInputFiltersDialog.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/OpenInputFiltersDialog.Request.g.cs new file mode 100644 index 0000000..57f41da --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/OpenInputFiltersDialog.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the OpenInputFiltersDialog request. +/// +/// +/// Opens the filters dialog of an input. +/// OBS WebSocket Protocol Category: ui | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record OpenInputFiltersDialogRequestData +{ + /// + /// Name of the input to open the dialog of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to open the dialog of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public OpenInputFiltersDialogRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public OpenInputFiltersDialogRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/OpenInputInteractDialog.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/OpenInputInteractDialog.Request.g.cs new file mode 100644 index 0000000..7ee9959 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/OpenInputInteractDialog.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the OpenInputInteractDialog request. +/// +/// +/// Opens the interact dialog of an input. +/// OBS WebSocket Protocol Category: ui | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record OpenInputInteractDialogRequestData +{ + /// + /// Name of the input to open the dialog of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to open the dialog of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public OpenInputInteractDialogRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public OpenInputInteractDialogRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/OpenInputPropertiesDialog.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/OpenInputPropertiesDialog.Request.g.cs new file mode 100644 index 0000000..a4cfb86 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/OpenInputPropertiesDialog.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the OpenInputPropertiesDialog request. +/// +/// +/// Opens the properties dialog of an input. +/// OBS WebSocket Protocol Category: ui | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record OpenInputPropertiesDialogRequestData +{ + /// + /// Name of the input to open the dialog of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to open the dialog of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public OpenInputPropertiesDialogRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public OpenInputPropertiesDialogRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/OpenSourceProjector.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/OpenSourceProjector.Request.g.cs new file mode 100644 index 0000000..9448ff6 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/OpenSourceProjector.Request.g.cs @@ -0,0 +1,91 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the OpenSourceProjector request. +/// +/// +/// Opens a projector for a source. +/// +/// Note: This request serves to provide feature parity with 4.x. It is very likely to be changed/deprecated in a future release. +/// OBS WebSocket Protocol Category: ui | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record OpenSourceProjectorRequestData +{ + /// + /// Monitor index, use `GetMonitorList` to obtain index + /// + /// + /// Optional: true + /// Behavior When Optional: -1: Opens projector in windowed mode + /// + [JsonPropertyName("monitorIndex")] + [Key("monitorIndex")] + public double? MonitorIndex { get; init; } + + /// + /// Size/Position data for a windowed projector, in Qt Base64 encoded format. Mutually exclusive with `monitorIndex` + /// + /// + /// Optional: true + /// Behavior When Optional: N/A + /// + [JsonPropertyName("projectorGeometry")] + [Key("projectorGeometry")] + public string? ProjectorGeometry { get; init; } + + /// + /// Name of the source to open a projector for + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source to open a projector for + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public OpenSourceProjectorRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public OpenSourceProjectorRequestData(string? sourceName = null, string? sourceUuid = null, double? monitorIndex = null, string? projectorGeometry = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.MonitorIndex = monitorIndex; + this.ProjectorGeometry = projectorGeometry; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/OpenVideoMixProjector.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/OpenVideoMixProjector.Request.g.cs new file mode 100644 index 0000000..d0d7277 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/OpenVideoMixProjector.Request.g.cs @@ -0,0 +1,85 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the OpenVideoMixProjector request. +/// +/// +/// Opens a projector for a specific output video mix. +/// +/// Mix types: +/// +/// - `OBS_WEBSOCKET_VIDEO_MIX_TYPE_PREVIEW` +/// - `OBS_WEBSOCKET_VIDEO_MIX_TYPE_PROGRAM` +/// - `OBS_WEBSOCKET_VIDEO_MIX_TYPE_MULTIVIEW` +/// +/// Note: This request serves to provide feature parity with 4.x. It is very likely to be changed/deprecated in a future release. +/// OBS WebSocket Protocol Category: ui | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record OpenVideoMixProjectorRequestData +{ + /// + /// Monitor index, use `GetMonitorList` to obtain index + /// + /// + /// Optional: true + /// Behavior When Optional: -1: Opens projector in windowed mode + /// + [JsonPropertyName("monitorIndex")] + [Key("monitorIndex")] + public double? MonitorIndex { get; init; } + + /// + /// Size/Position data for a windowed projector, in Qt Base64 encoded format. Mutually exclusive with `monitorIndex` + /// + /// + /// Optional: true + /// Behavior When Optional: N/A + /// + [JsonPropertyName("projectorGeometry")] + [Key("projectorGeometry")] + public string? ProjectorGeometry { get; init; } + + /// + /// Type of mix to open + /// + /// + /// Optional: false + /// + [JsonPropertyName("videoMixType")] + [Key("videoMixType")] + public required string VideoMixType { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public OpenVideoMixProjectorRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenVideoMixProjectorRequestData(string videoMixType, double? monitorIndex = null, string? projectorGeometry = null) + { + this.VideoMixType = videoMixType; + this.MonitorIndex = monitorIndex; + this.ProjectorGeometry = projectorGeometry; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/PressInputPropertiesButton.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/PressInputPropertiesButton.Request.g.cs new file mode 100644 index 0000000..9f6b981 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/PressInputPropertiesButton.Request.g.cs @@ -0,0 +1,83 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the PressInputPropertiesButton request. +/// +/// +/// Presses a button in the properties of an input. +/// +/// Some known `propertyName` values are: +/// +/// - `refreshnocache` - Browser source reload button +/// +/// Note: Use this in cases where there is a button in the properties of an input that cannot be accessed in any other way. For example, browser sources, where there is a refresh button. +/// OBS WebSocket Protocol Category: inputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record PressInputPropertiesButtonRequestData +{ + /// + /// Name of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// Name of the button property to press + /// + /// + /// Optional: false + /// + [JsonPropertyName("propertyName")] + [Key("propertyName")] + public required string PropertyName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public PressInputPropertiesButtonRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PressInputPropertiesButtonRequestData(string propertyName, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.PropertyName = propertyName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveInput.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveInput.Request.g.cs new file mode 100644 index 0000000..76f5c91 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveInput.Request.g.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the RemoveInput request. +/// +/// +/// Removes an existing input. +/// +/// Note: Will immediately remove all associated scene items. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record RemoveInputRequestData +{ + /// + /// Name of the input to remove + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to remove + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public RemoveInputRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public RemoveInputRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveProfile.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveProfile.Request.g.cs new file mode 100644 index 0000000..00f366e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveProfile.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the RemoveProfile request. +/// +/// +/// Removes a profile. If the current profile is chosen, it will change to a different profile first. +/// OBS WebSocket Protocol Category: config | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record RemoveProfileRequestData +{ + /// + /// Name of the profile to remove + /// + /// + /// Optional: false + /// + [JsonPropertyName("profileName")] + [Key("profileName")] + public required string ProfileName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public RemoveProfileRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveProfileRequestData(string profileName) + { + this.ProfileName = profileName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveScene.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveScene.Request.g.cs new file mode 100644 index 0000000..c5f275e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveScene.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the RemoveScene request. +/// +/// +/// Removes a scene from OBS. +/// OBS WebSocket Protocol Category: scenes | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record RemoveSceneRequestData +{ + /// + /// Name of the scene to remove + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene to remove + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public RemoveSceneRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public RemoveSceneRequestData(string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveSceneItem.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveSceneItem.Request.g.cs new file mode 100644 index 0000000..191691c --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveSceneItem.Request.g.cs @@ -0,0 +1,80 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the RemoveSceneItem request. +/// +/// +/// Removes a scene item from a scene. +/// +/// Scenes only +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record RemoveSceneItemRequestData +{ + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public RemoveSceneItemRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveSceneItemRequestData(double sceneItemId, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveSourceFilter.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveSourceFilter.Request.g.cs new file mode 100644 index 0000000..08cd73d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/RemoveSourceFilter.Request.g.cs @@ -0,0 +1,77 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the RemoveSourceFilter request. +/// +/// +/// Removes a filter from a source. +/// OBS WebSocket Protocol Category: filters | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record RemoveSourceFilterRequestData +{ + /// + /// Name of the filter to remove + /// + /// + /// Optional: false + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public required string FilterName { get; init; } + + /// + /// Name of the source the filter is on + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source the filter is on + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public RemoveSourceFilterRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RemoveSourceFilterRequestData(string filterName, string? sourceName = null, string? sourceUuid = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.FilterName = filterName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SaveSourceScreenshot.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SaveSourceScreenshot.Request.g.cs new file mode 100644 index 0000000..6616c8b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SaveSourceScreenshot.Request.g.cs @@ -0,0 +1,132 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SaveSourceScreenshot request. +/// +/// +/// Saves a screenshot of a source to the filesystem. +/// +/// The `imageWidth` and `imageHeight` parameters are treated as "scale to inner", meaning the smallest ratio will be used and the aspect ratio of the original resolution is kept. +/// If `imageWidth` and `imageHeight` are not specified, the compressed image will use the full resolution of the source. +/// +/// **Compatible with inputs and scenes.** +/// OBS WebSocket Protocol Category: sources | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SaveSourceScreenshotRequestData +{ + /// + /// Compression quality to use. 0 for high compression, 100 for uncompressed. -1 to use "default" (whatever that means, idk) + /// + /// + /// Restrictions: >= -1, <= 100 + /// Optional: true + /// Behavior When Optional: -1 + /// + [JsonPropertyName("imageCompressionQuality")] + [Key("imageCompressionQuality")] + public double? ImageCompressionQuality { get; init; } + + /// + /// Path to save the screenshot file to. Eg. `C:\Users\user\Desktop\screenshot.png` + /// + /// + /// Optional: false + /// + [JsonPropertyName("imageFilePath")] + [Key("imageFilePath")] + public required string ImageFilePath { get; init; } + + /// + /// Image compression format to use. Use `GetVersion` to get compatible image formats + /// + /// + /// Optional: false + /// + [JsonPropertyName("imageFormat")] + [Key("imageFormat")] + public required string ImageFormat { get; init; } + + /// + /// Height to scale the screenshot to + /// + /// + /// Restrictions: >= 8, <= 4096 + /// Optional: true + /// Behavior When Optional: Source value is used + /// + [JsonPropertyName("imageHeight")] + [Key("imageHeight")] + public double? ImageHeight { get; init; } + + /// + /// Width to scale the screenshot to + /// + /// + /// Restrictions: >= 8, <= 4096 + /// Optional: true + /// Behavior When Optional: Source value is used + /// + [JsonPropertyName("imageWidth")] + [Key("imageWidth")] + public double? ImageWidth { get; init; } + + /// + /// Name of the source to take a screenshot of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source to take a screenshot of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SaveSourceScreenshotRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SaveSourceScreenshotRequestData(string imageFormat, string imageFilePath, string? sourceName = null, string? sourceUuid = null, double? imageWidth = null, double? imageHeight = null, double? imageCompressionQuality = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.ImageFormat = imageFormat; + this.ImageFilePath = imageFilePath; + this.ImageWidth = imageWidth; + this.ImageHeight = imageHeight; + this.ImageCompressionQuality = imageCompressionQuality; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SendStreamCaption.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SendStreamCaption.Request.g.cs new file mode 100644 index 0000000..5bcb262 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SendStreamCaption.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SendStreamCaption request. +/// +/// +/// Sends CEA-608 caption text over the stream output. +/// OBS WebSocket Protocol Category: stream | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SendStreamCaptionRequestData +{ + /// + /// Caption text + /// + /// + /// Optional: false + /// + [JsonPropertyName("captionText")] + [Key("captionText")] + public required string CaptionText { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SendStreamCaptionRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SendStreamCaptionRequestData(string captionText) + { + this.CaptionText = captionText; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentPreviewScene.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentPreviewScene.Request.g.cs new file mode 100644 index 0000000..de2e878 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentPreviewScene.Request.g.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetCurrentPreviewScene request. +/// +/// +/// Sets the current preview scene. +/// +/// Only available when studio mode is enabled. +/// OBS WebSocket Protocol Category: scenes | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetCurrentPreviewSceneRequestData +{ + /// + /// Scene name to set as the current preview scene + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// Scene UUID to set as the current preview scene + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetCurrentPreviewSceneRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SetCurrentPreviewSceneRequestData(string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentProfile.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentProfile.Request.g.cs new file mode 100644 index 0000000..081e878 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentProfile.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetCurrentProfile request. +/// +/// +/// Switches to a profile. +/// OBS WebSocket Protocol Category: config | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetCurrentProfileRequestData +{ + /// + /// Name of the profile to switch to + /// + /// + /// Optional: false + /// + [JsonPropertyName("profileName")] + [Key("profileName")] + public required string ProfileName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetCurrentProfileRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetCurrentProfileRequestData(string profileName) + { + this.ProfileName = profileName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentProgramScene.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentProgramScene.Request.g.cs new file mode 100644 index 0000000..4931130 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentProgramScene.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetCurrentProgramScene request. +/// +/// +/// Sets the current program scene. +/// OBS WebSocket Protocol Category: scenes | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetCurrentProgramSceneRequestData +{ + /// + /// Scene name to set as the current program scene + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// Scene UUID to set as the current program scene + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetCurrentProgramSceneRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SetCurrentProgramSceneRequestData(string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneCollection.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneCollection.Request.g.cs new file mode 100644 index 0000000..0285860 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneCollection.Request.g.cs @@ -0,0 +1,55 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetCurrentSceneCollection request. +/// +/// +/// Switches to a scene collection. +/// +/// Note: This will block until the collection has finished changing. +/// OBS WebSocket Protocol Category: config | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetCurrentSceneCollectionRequestData +{ + /// + /// Name of the scene collection to switch to + /// + /// + /// Optional: false + /// + [JsonPropertyName("sceneCollectionName")] + [Key("sceneCollectionName")] + public required string SceneCollectionName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetCurrentSceneCollectionRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetCurrentSceneCollectionRequestData(string sceneCollectionName) + { + this.SceneCollectionName = sceneCollectionName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneTransition.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneTransition.Request.g.cs new file mode 100644 index 0000000..e15c084 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneTransition.Request.g.cs @@ -0,0 +1,55 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetCurrentSceneTransition request. +/// +/// +/// Sets the current scene transition. +/// +/// Small note: While the namespace of scene transitions is generally unique, that uniqueness is not a guarantee as it is with other resources like inputs. +/// OBS WebSocket Protocol Category: transitions | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetCurrentSceneTransitionRequestData +{ + /// + /// Name of the transition to make active + /// + /// + /// Optional: false + /// + [JsonPropertyName("transitionName")] + [Key("transitionName")] + public required string TransitionName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetCurrentSceneTransitionRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetCurrentSceneTransitionRequestData(string transitionName) + { + this.TransitionName = transitionName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneTransitionDuration.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneTransitionDuration.Request.g.cs new file mode 100644 index 0000000..6af8b2b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneTransitionDuration.Request.g.cs @@ -0,0 +1,54 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetCurrentSceneTransitionDuration request. +/// +/// +/// Sets the duration of the current scene transition, if it is not fixed. +/// OBS WebSocket Protocol Category: transitions | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetCurrentSceneTransitionDurationRequestData +{ + /// + /// Duration in milliseconds + /// + /// + /// Restrictions: >= 50, <= 20000 + /// Optional: false + /// + [JsonPropertyName("transitionDuration")] + [Key("transitionDuration")] + public required double TransitionDuration { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetCurrentSceneTransitionDurationRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetCurrentSceneTransitionDurationRequestData(double transitionDuration) + { + this.TransitionDuration = transitionDuration; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneTransitionSettings.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneTransitionSettings.Request.g.cs new file mode 100644 index 0000000..82b2b97 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetCurrentSceneTransitionSettings.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetCurrentSceneTransitionSettings request. +/// +/// +/// Sets the settings of the current scene transition. +/// OBS WebSocket Protocol Category: transitions | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetCurrentSceneTransitionSettingsRequestData +{ + /// + /// Whether to overlay over the current settings or replace them + /// + /// + /// Optional: true + /// Behavior When Optional: true + /// + [JsonPropertyName("overlay")] + [Key("overlay")] + public bool? Overlay { get; init; } + + /// + /// Settings object to apply to the transition. Can be `{}` + /// + /// + /// Optional: false + /// + [JsonPropertyName("transitionSettings")] + [Key("transitionSettings")] + public required System.Text.Json.JsonElement? TransitionSettings { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetCurrentSceneTransitionSettingsRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetCurrentSceneTransitionSettingsRequestData(System.Text.Json.JsonElement? transitionSettings, bool? overlay = null) + { + this.TransitionSettings = transitionSettings; + this.Overlay = overlay; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioBalance.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioBalance.Request.g.cs new file mode 100644 index 0000000..c7aef6f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioBalance.Request.g.cs @@ -0,0 +1,78 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetInputAudioBalance request. +/// +/// +/// Sets the audio balance of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetInputAudioBalanceRequestData +{ + /// + /// New audio balance value + /// + /// + /// Restrictions: >= 0.0, <= 1.0 + /// Optional: false + /// + [JsonPropertyName("inputAudioBalance")] + [Key("inputAudioBalance")] + public required double InputAudioBalance { get; init; } + + /// + /// Name of the input to set the audio balance of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to set the audio balance of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetInputAudioBalanceRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetInputAudioBalanceRequestData(double inputAudioBalance, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputAudioBalance = inputAudioBalance; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioMonitorType.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioMonitorType.Request.g.cs new file mode 100644 index 0000000..70f2170 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioMonitorType.Request.g.cs @@ -0,0 +1,77 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetInputAudioMonitorType request. +/// +/// +/// Sets the audio monitor type of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetInputAudioMonitorTypeRequestData +{ + /// + /// Name of the input to set the audio monitor type of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to set the audio monitor type of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// Audio monitor type + /// + /// + /// Optional: false + /// + [JsonPropertyName("monitorType")] + [Key("monitorType")] + public required string MonitorType { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetInputAudioMonitorTypeRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetInputAudioMonitorTypeRequestData(string monitorType, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.MonitorType = monitorType; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioSyncOffset.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioSyncOffset.Request.g.cs new file mode 100644 index 0000000..95dbf74 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioSyncOffset.Request.g.cs @@ -0,0 +1,78 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetInputAudioSyncOffset request. +/// +/// +/// Sets the audio sync offset of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetInputAudioSyncOffsetRequestData +{ + /// + /// New audio sync offset in milliseconds + /// + /// + /// Restrictions: >= -950, <= 20000 + /// Optional: false + /// + [JsonPropertyName("inputAudioSyncOffset")] + [Key("inputAudioSyncOffset")] + public required double InputAudioSyncOffset { get; init; } + + /// + /// Name of the input to set the audio sync offset of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to set the audio sync offset of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetInputAudioSyncOffsetRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetInputAudioSyncOffsetRequestData(double inputAudioSyncOffset, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputAudioSyncOffset = inputAudioSyncOffset; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioTracks.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioTracks.Request.g.cs new file mode 100644 index 0000000..6982b5d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputAudioTracks.Request.g.cs @@ -0,0 +1,77 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetInputAudioTracks request. +/// +/// +/// Sets the enable state of audio tracks of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetInputAudioTracksRequestData +{ + /// + /// Track settings to apply + /// + /// + /// Optional: false + /// + [JsonPropertyName("inputAudioTracks")] + [Key("inputAudioTracks")] + public required System.Collections.Generic.Dictionary? InputAudioTracks { get; init; } + + /// + /// Name of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetInputAudioTracksRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetInputAudioTracksRequestData(System.Collections.Generic.Dictionary? inputAudioTracks, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputAudioTracks = inputAudioTracks; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputDeinterlaceFieldOrder.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputDeinterlaceFieldOrder.Request.g.cs new file mode 100644 index 0000000..e45cdf3 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputDeinterlaceFieldOrder.Request.g.cs @@ -0,0 +1,79 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetInputDeinterlaceFieldOrder request. +/// +/// +/// Sets the deinterlace field order of an input. +/// +/// Note: Deinterlacing functionality is restricted to async inputs only. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.6.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetInputDeinterlaceFieldOrderRequestData +{ + /// + /// Deinterlace field order for the input + /// + /// + /// Optional: false + /// + [JsonPropertyName("inputDeinterlaceFieldOrder")] + [Key("inputDeinterlaceFieldOrder")] + public required string InputDeinterlaceFieldOrder { get; init; } + + /// + /// Name of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetInputDeinterlaceFieldOrderRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetInputDeinterlaceFieldOrderRequestData(string inputDeinterlaceFieldOrder, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputDeinterlaceFieldOrder = inputDeinterlaceFieldOrder; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputDeinterlaceMode.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputDeinterlaceMode.Request.g.cs new file mode 100644 index 0000000..2c78f64 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputDeinterlaceMode.Request.g.cs @@ -0,0 +1,79 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetInputDeinterlaceMode request. +/// +/// +/// Sets the deinterlace mode of an input. +/// +/// Note: Deinterlacing functionality is restricted to async inputs only. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.6.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetInputDeinterlaceModeRequestData +{ + /// + /// Deinterlace mode for the input + /// + /// + /// Optional: false + /// + [JsonPropertyName("inputDeinterlaceMode")] + [Key("inputDeinterlaceMode")] + public required string InputDeinterlaceMode { get; init; } + + /// + /// Name of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetInputDeinterlaceModeRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetInputDeinterlaceModeRequestData(string inputDeinterlaceMode, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputDeinterlaceMode = inputDeinterlaceMode; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputMute.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputMute.Request.g.cs new file mode 100644 index 0000000..d0f21ec --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputMute.Request.g.cs @@ -0,0 +1,77 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetInputMute request. +/// +/// +/// Sets the audio mute state of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetInputMuteRequestData +{ + /// + /// Whether to mute the input or not + /// + /// + /// Optional: false + /// + [JsonPropertyName("inputMuted")] + [Key("inputMuted")] + public required bool InputMuted { get; init; } + + /// + /// Name of the input to set the mute state of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to set the mute state of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetInputMuteRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetInputMuteRequestData(bool inputMuted, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputMuted = inputMuted; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputName.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputName.Request.g.cs new file mode 100644 index 0000000..529cab0 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputName.Request.g.cs @@ -0,0 +1,77 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetInputName request. +/// +/// +/// Sets the name of an input (rename). +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetInputNameRequestData +{ + /// + /// Current input name + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// Current input UUID + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// New name for the input + /// + /// + /// Optional: false + /// + [JsonPropertyName("newInputName")] + [Key("newInputName")] + public required string NewInputName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetInputNameRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetInputNameRequestData(string newInputName, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.NewInputName = newInputName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputSettings.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputSettings.Request.g.cs new file mode 100644 index 0000000..5a46049 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputSettings.Request.g.cs @@ -0,0 +1,89 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetInputSettings request. +/// +/// +/// Sets the settings of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetInputSettingsRequestData +{ + /// + /// Name of the input to set the settings of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// Object of settings to apply + /// + /// + /// Optional: false + /// + [JsonPropertyName("inputSettings")] + [Key("inputSettings")] + public required System.Text.Json.JsonElement? InputSettings { get; init; } + + /// + /// UUID of the input to set the settings of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// True == apply the settings on top of existing ones, False == reset the input to its defaults, then apply settings. + /// + /// + /// Optional: true + /// Behavior When Optional: true + /// + [JsonPropertyName("overlay")] + [Key("overlay")] + public bool? Overlay { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetInputSettingsRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetInputSettingsRequestData(System.Text.Json.JsonElement? inputSettings, string? inputName = null, string? inputUuid = null, bool? overlay = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputSettings = inputSettings; + this.Overlay = overlay; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputVolume.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputVolume.Request.g.cs new file mode 100644 index 0000000..0b6d9b9 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetInputVolume.Request.g.cs @@ -0,0 +1,91 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetInputVolume request. +/// +/// +/// Sets the volume setting of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetInputVolumeRequestData +{ + /// + /// Name of the input to set the volume of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to set the volume of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// Volume setting in dB + /// + /// + /// Restrictions: >= -100, <= 26 + /// Optional: true + /// Behavior When Optional: `inputVolumeMul` should be specified + /// + [JsonPropertyName("inputVolumeDb")] + [Key("inputVolumeDb")] + public double? InputVolumeDb { get; init; } + + /// + /// Volume setting in mul + /// + /// + /// Restrictions: >= 0, <= 20 + /// Optional: true + /// Behavior When Optional: `inputVolumeDb` should be specified + /// + [JsonPropertyName("inputVolumeMul")] + [Key("inputVolumeMul")] + public double? InputVolumeMul { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetInputVolumeRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SetInputVolumeRequestData(string? inputName = null, string? inputUuid = null, double? inputVolumeMul = null, double? inputVolumeDb = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.InputVolumeMul = inputVolumeMul; + this.InputVolumeDb = inputVolumeDb; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetMediaInputCursor.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetMediaInputCursor.Request.g.cs new file mode 100644 index 0000000..35adc7f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetMediaInputCursor.Request.g.cs @@ -0,0 +1,80 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetMediaInputCursor request. +/// +/// +/// Sets the cursor position of a media input. +/// +/// This request does not perform bounds checking of the cursor position. +/// OBS WebSocket Protocol Category: media inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetMediaInputCursorRequestData +{ + /// + /// Name of the media input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the media input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// New cursor position to set + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("mediaCursor")] + [Key("mediaCursor")] + public required double MediaCursor { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetMediaInputCursorRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetMediaInputCursorRequestData(double mediaCursor, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.MediaCursor = mediaCursor; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetOutputSettings.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetOutputSettings.Request.g.cs new file mode 100644 index 0000000..c6efe5d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetOutputSettings.Request.g.cs @@ -0,0 +1,64 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetOutputSettings request. +/// +/// +/// Sets the settings of an output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetOutputSettingsRequestData +{ + /// + /// Output name + /// + /// + /// Optional: false + /// + [JsonPropertyName("outputName")] + [Key("outputName")] + public required string OutputName { get; init; } + + /// + /// Output settings + /// + /// + /// Optional: false + /// + [JsonPropertyName("outputSettings")] + [Key("outputSettings")] + public required System.Text.Json.JsonElement? OutputSettings { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetOutputSettingsRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetOutputSettingsRequestData(string outputName, System.Text.Json.JsonElement? outputSettings) + { + this.OutputName = outputName; + this.OutputSettings = outputSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetPersistentData.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetPersistentData.Request.g.cs new file mode 100644 index 0000000..25a91a8 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetPersistentData.Request.g.cs @@ -0,0 +1,75 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetPersistentData request. +/// +/// +/// Sets the value of a "slot" from the selected persistent data realm. +/// OBS WebSocket Protocol Category: config | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetPersistentDataRequestData +{ + /// + /// The data realm to select. `OBS_WEBSOCKET_DATA_REALM_GLOBAL` or `OBS_WEBSOCKET_DATA_REALM_PROFILE` + /// + /// + /// Optional: false + /// + [JsonPropertyName("realm")] + [Key("realm")] + public required string Realm { get; init; } + + /// + /// The name of the slot to retrieve data from + /// + /// + /// Optional: false + /// + [JsonPropertyName("slotName")] + [Key("slotName")] + public required string SlotName { get; init; } + + /// + /// The value to apply to the slot + /// + /// + /// Optional: false + /// + [JsonPropertyName("slotValue")] + [Key("slotValue")] + public required System.Text.Json.JsonElement? SlotValue { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetPersistentDataRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetPersistentDataRequestData(string realm, string slotName, System.Text.Json.JsonElement? slotValue) + { + this.Realm = realm; + this.SlotName = slotName; + this.SlotValue = slotValue; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetProfileParameter.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetProfileParameter.Request.g.cs new file mode 100644 index 0000000..8a3d674 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetProfileParameter.Request.g.cs @@ -0,0 +1,75 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetProfileParameter request. +/// +/// +/// Sets the value of a parameter in the current profile's configuration. +/// OBS WebSocket Protocol Category: config | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetProfileParameterRequestData +{ + /// + /// Category of the parameter to set + /// + /// + /// Optional: false + /// + [JsonPropertyName("parameterCategory")] + [Key("parameterCategory")] + public required string ParameterCategory { get; init; } + + /// + /// Name of the parameter to set + /// + /// + /// Optional: false + /// + [JsonPropertyName("parameterName")] + [Key("parameterName")] + public required string ParameterName { get; init; } + + /// + /// Value of the parameter to set. Use `null` to delete + /// + /// + /// Optional: false + /// + [JsonPropertyName("parameterValue")] + [Key("parameterValue")] + public required string ParameterValue { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetProfileParameterRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetProfileParameterRequestData(string parameterCategory, string parameterName, string parameterValue) + { + this.ParameterCategory = parameterCategory; + this.ParameterName = parameterName; + this.ParameterValue = parameterValue; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetRecordDirectory.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetRecordDirectory.Request.g.cs new file mode 100644 index 0000000..495240e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetRecordDirectory.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetRecordDirectory request. +/// +/// +/// Sets the current directory that the record output writes files to. +/// OBS WebSocket Protocol Category: config | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.3.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetRecordDirectoryRequestData +{ + /// + /// Output directory + /// + /// + /// Optional: false + /// + [JsonPropertyName("recordDirectory")] + [Key("recordDirectory")] + public required string RecordDirectory { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetRecordDirectoryRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetRecordDirectoryRequestData(string recordDirectory) + { + this.RecordDirectory = recordDirectory; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemBlendMode.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemBlendMode.Request.g.cs new file mode 100644 index 0000000..34aaa85 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemBlendMode.Request.g.cs @@ -0,0 +1,91 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetSceneItemBlendMode request. +/// +/// +/// Sets the blend mode of a scene item. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetSceneItemBlendModeRequestData +{ + /// + /// New blend mode + /// + /// + /// Optional: false + /// + [JsonPropertyName("sceneItemBlendMode")] + [Key("sceneItemBlendMode")] + public required string SceneItemBlendMode { get; init; } + + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetSceneItemBlendModeRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSceneItemBlendModeRequestData(double sceneItemId, string sceneItemBlendMode, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + this.SceneItemBlendMode = sceneItemBlendMode; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemEnabled.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemEnabled.Request.g.cs new file mode 100644 index 0000000..c0ac259 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemEnabled.Request.g.cs @@ -0,0 +1,91 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetSceneItemEnabled request. +/// +/// +/// Sets the enable state of a scene item. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetSceneItemEnabledRequestData +{ + /// + /// New enable state of the scene item + /// + /// + /// Optional: false + /// + [JsonPropertyName("sceneItemEnabled")] + [Key("sceneItemEnabled")] + public required bool SceneItemEnabled { get; init; } + + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetSceneItemEnabledRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSceneItemEnabledRequestData(double sceneItemId, bool sceneItemEnabled, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + this.SceneItemEnabled = sceneItemEnabled; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemIndex.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemIndex.Request.g.cs new file mode 100644 index 0000000..7cd0b70 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemIndex.Request.g.cs @@ -0,0 +1,92 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetSceneItemIndex request. +/// +/// +/// Sets the index position of a scene item in a scene. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetSceneItemIndexRequestData +{ + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// New index position of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemIndex")] + [Key("sceneItemIndex")] + public required double SceneItemIndex { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetSceneItemIndexRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSceneItemIndexRequestData(double sceneItemId, double sceneItemIndex, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + this.SceneItemIndex = sceneItemIndex; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemLocked.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemLocked.Request.g.cs new file mode 100644 index 0000000..cc578c1 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemLocked.Request.g.cs @@ -0,0 +1,91 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetSceneItemLocked request. +/// +/// +/// Sets the lock state of a scene item. +/// +/// Scenes and Group +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetSceneItemLockedRequestData +{ + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// New lock state of the scene item + /// + /// + /// Optional: false + /// + [JsonPropertyName("sceneItemLocked")] + [Key("sceneItemLocked")] + public required bool SceneItemLocked { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetSceneItemLockedRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSceneItemLockedRequestData(double sceneItemId, bool sceneItemLocked, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + this.SceneItemLocked = sceneItemLocked; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemTransform.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemTransform.Request.g.cs new file mode 100644 index 0000000..ccc97f7 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneItemTransform.Request.g.cs @@ -0,0 +1,89 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetSceneItemTransform request. +/// +/// +/// Sets the transform and crop info of a scene item. +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetSceneItemTransformRequestData +{ + /// + /// Numeric ID of the scene item + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// + /// Object containing scene item transform info to update + /// + /// + /// Optional: false + /// + [JsonPropertyName("sceneItemTransform")] + [Key("sceneItemTransform")] + public required ObsWebSocket.Core.Protocol.Common.SceneItemTransformStub? SceneItemTransform { get; init; } + + /// + /// Name of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene the item is in + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetSceneItemTransformRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSceneItemTransformRequestData(double sceneItemId, ObsWebSocket.Core.Protocol.Common.SceneItemTransformStub? sceneItemTransform, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.SceneItemId = sceneItemId; + this.SceneItemTransform = sceneItemTransform; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneName.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneName.Request.g.cs new file mode 100644 index 0000000..253dce6 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneName.Request.g.cs @@ -0,0 +1,77 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetSceneName request. +/// +/// +/// Sets the name of a scene (rename). +/// OBS WebSocket Protocol Category: scenes | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetSceneNameRequestData +{ + /// + /// New name for the scene + /// + /// + /// Optional: false + /// + [JsonPropertyName("newSceneName")] + [Key("newSceneName")] + public required string NewSceneName { get; init; } + + /// + /// Name of the scene to be renamed + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene to be renamed + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetSceneNameRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSceneNameRequestData(string newSceneName, string? sceneName = null, string? sceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.NewSceneName = newSceneName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneSceneTransitionOverride.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneSceneTransitionOverride.Request.g.cs new file mode 100644 index 0000000..ca2065b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSceneSceneTransitionOverride.Request.g.cs @@ -0,0 +1,90 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetSceneSceneTransitionOverride request. +/// +/// +/// Sets the scene transition overridden for a scene. +/// OBS WebSocket Protocol Category: scenes | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetSceneSceneTransitionOverrideRequestData +{ + /// + /// Name of the scene + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// UUID of the scene + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// + /// Duration to use for any overridden transition. Specify `null` to remove + /// + /// + /// Restrictions: >= 50, <= 20000 + /// Optional: true + /// Behavior When Optional: Unchanged + /// + [JsonPropertyName("transitionDuration")] + [Key("transitionDuration")] + public double? TransitionDuration { get; init; } + + /// + /// Name of the scene transition to use as override. Specify `null` to remove + /// + /// + /// Optional: true + /// Behavior When Optional: Unchanged + /// + [JsonPropertyName("transitionName")] + [Key("transitionName")] + public string? TransitionName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetSceneSceneTransitionOverrideRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SetSceneSceneTransitionOverrideRequestData(string? sceneName = null, string? sceneUuid = null, string? transitionName = null, double? transitionDuration = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.TransitionName = transitionName; + this.TransitionDuration = transitionDuration; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterEnabled.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterEnabled.Request.g.cs new file mode 100644 index 0000000..fb2ed5b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterEnabled.Request.g.cs @@ -0,0 +1,88 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetSourceFilterEnabled request. +/// +/// +/// Sets the enable state of a source filter. +/// OBS WebSocket Protocol Category: filters | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetSourceFilterEnabledRequestData +{ + /// + /// New enable state of the filter + /// + /// + /// Optional: false + /// + [JsonPropertyName("filterEnabled")] + [Key("filterEnabled")] + public required bool FilterEnabled { get; init; } + + /// + /// Name of the filter + /// + /// + /// Optional: false + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public required string FilterName { get; init; } + + /// + /// Name of the source the filter is on + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source the filter is on + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetSourceFilterEnabledRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSourceFilterEnabledRequestData(string filterName, bool filterEnabled, string? sourceName = null, string? sourceUuid = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.FilterName = filterName; + this.FilterEnabled = filterEnabled; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterIndex.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterIndex.Request.g.cs new file mode 100644 index 0000000..0fcf8e8 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterIndex.Request.g.cs @@ -0,0 +1,89 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetSourceFilterIndex request. +/// +/// +/// Sets the index position of a filter on a source. +/// OBS WebSocket Protocol Category: filters | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetSourceFilterIndexRequestData +{ + /// + /// New index position of the filter + /// + /// + /// Restrictions: >= 0 + /// Optional: false + /// + [JsonPropertyName("filterIndex")] + [Key("filterIndex")] + public required double FilterIndex { get; init; } + + /// + /// Name of the filter + /// + /// + /// Optional: false + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public required string FilterName { get; init; } + + /// + /// Name of the source the filter is on + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source the filter is on + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetSourceFilterIndexRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSourceFilterIndexRequestData(string filterName, double filterIndex, string? sourceName = null, string? sourceUuid = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.FilterName = filterName; + this.FilterIndex = filterIndex; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterName.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterName.Request.g.cs new file mode 100644 index 0000000..9ebab1d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterName.Request.g.cs @@ -0,0 +1,88 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetSourceFilterName request. +/// +/// +/// Sets the name of a source filter (rename). +/// OBS WebSocket Protocol Category: filters | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetSourceFilterNameRequestData +{ + /// + /// Current name of the filter + /// + /// + /// Optional: false + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public required string FilterName { get; init; } + + /// + /// New name for the filter + /// + /// + /// Optional: false + /// + [JsonPropertyName("newFilterName")] + [Key("newFilterName")] + public required string NewFilterName { get; init; } + + /// + /// Name of the source the filter is on + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source the filter is on + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetSourceFilterNameRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSourceFilterNameRequestData(string filterName, string newFilterName, string? sourceName = null, string? sourceUuid = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.FilterName = filterName; + this.NewFilterName = newFilterName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterSettings.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterSettings.Request.g.cs new file mode 100644 index 0000000..858b8ce --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetSourceFilterSettings.Request.g.cs @@ -0,0 +1,100 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetSourceFilterSettings request. +/// +/// +/// Sets the settings of a source filter. +/// OBS WebSocket Protocol Category: filters | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetSourceFilterSettingsRequestData +{ + /// + /// Name of the filter to set the settings of + /// + /// + /// Optional: false + /// + [JsonPropertyName("filterName")] + [Key("filterName")] + public required string FilterName { get; init; } + + /// + /// Object of settings to apply + /// + /// + /// Optional: false + /// + [JsonPropertyName("filterSettings")] + [Key("filterSettings")] + public required System.Text.Json.JsonElement? FilterSettings { get; init; } + + /// + /// True == apply the settings on top of existing ones, False == reset the input to its defaults, then apply settings. + /// + /// + /// Optional: true + /// Behavior When Optional: true + /// + [JsonPropertyName("overlay")] + [Key("overlay")] + public bool? Overlay { get; init; } + + /// + /// Name of the source the filter is on + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source the filter is on + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetSourceFilterSettingsRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetSourceFilterSettingsRequestData(string filterName, System.Text.Json.JsonElement? filterSettings, string? sourceName = null, string? sourceUuid = null, bool? overlay = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + this.FilterName = filterName; + this.FilterSettings = filterSettings; + this.Overlay = overlay; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetStreamServiceSettings.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetStreamServiceSettings.Request.g.cs new file mode 100644 index 0000000..5a5f443 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetStreamServiceSettings.Request.g.cs @@ -0,0 +1,66 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetStreamServiceSettings request. +/// +/// +/// Sets the current stream service settings (stream destination). +/// +/// Note: Simple RTMP settings can be set with type `rtmp_custom` and the settings fields `server` and `key`. +/// OBS WebSocket Protocol Category: config | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetStreamServiceSettingsRequestData +{ + /// + /// Settings to apply to the service + /// + /// + /// Optional: false + /// + [JsonPropertyName("streamServiceSettings")] + [Key("streamServiceSettings")] + public required System.Text.Json.JsonElement? StreamServiceSettings { get; init; } + + /// + /// Type of stream service to apply. Example: `rtmp_common` or `rtmp_custom` + /// + /// + /// Optional: false + /// + [JsonPropertyName("streamServiceType")] + [Key("streamServiceType")] + public required string StreamServiceType { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetStreamServiceSettingsRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetStreamServiceSettingsRequestData(string streamServiceType, System.Text.Json.JsonElement? streamServiceSettings) + { + this.StreamServiceType = streamServiceType; + this.StreamServiceSettings = streamServiceSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetStudioModeEnabled.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetStudioModeEnabled.Request.g.cs new file mode 100644 index 0000000..748a00b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetStudioModeEnabled.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetStudioModeEnabled request. +/// +/// +/// Enables or disables studio mode +/// OBS WebSocket Protocol Category: ui | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetStudioModeEnabledRequestData +{ + /// + /// True == Enabled, False == Disabled + /// + /// + /// Optional: false + /// + [JsonPropertyName("studioModeEnabled")] + [Key("studioModeEnabled")] + public required bool StudioModeEnabled { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetStudioModeEnabledRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetStudioModeEnabledRequestData(bool studioModeEnabled) + { + this.StudioModeEnabled = studioModeEnabled; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetTBarPosition.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetTBarPosition.Request.g.cs new file mode 100644 index 0000000..fffc0c3 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetTBarPosition.Request.g.cs @@ -0,0 +1,68 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetTBarPosition request. +/// +/// +/// Sets the position of the TBar. +/// +/// **Very important note**: This will be deprecated and replaced in a future version of obs-websocket. +/// OBS WebSocket Protocol Category: transitions | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetTBarPositionRequestData +{ + /// + /// New position + /// + /// + /// Restrictions: >= 0.0, <= 1.0 + /// Optional: false + /// + [JsonPropertyName("position")] + [Key("position")] + public required double Position { get; init; } + + /// + /// Whether to release the TBar. Only set `false` if you know that you will be sending another position update + /// + /// + /// Optional: true + /// Behavior When Optional: `true` + /// + [JsonPropertyName("release")] + [Key("release")] + public bool? Release { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetTBarPositionRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public SetTBarPositionRequestData(double position, bool? release = null) + { + this.Position = position; + this.Release = release; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/SetVideoSettings.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/SetVideoSettings.Request.g.cs new file mode 100644 index 0000000..f37cbdb --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/SetVideoSettings.Request.g.cs @@ -0,0 +1,121 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the SetVideoSettings request. +/// +/// +/// Sets the current video settings. +/// +/// Note: Fields must be specified in pairs. For example, you cannot set only `baseWidth` without needing to specify `baseHeight`. +/// OBS WebSocket Protocol Category: config | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SetVideoSettingsRequestData +{ + /// + /// Height of the base (canvas) resolution in pixels + /// + /// + /// Restrictions: >= 1, <= 4096 + /// Optional: true + /// Behavior When Optional: Not changed + /// + [JsonPropertyName("baseHeight")] + [Key("baseHeight")] + public double? BaseHeight { get; init; } + + /// + /// Width of the base (canvas) resolution in pixels + /// + /// + /// Restrictions: >= 1, <= 4096 + /// Optional: true + /// Behavior When Optional: Not changed + /// + [JsonPropertyName("baseWidth")] + [Key("baseWidth")] + public double? BaseWidth { get; init; } + + /// + /// Denominator of the fractional FPS value + /// + /// + /// Restrictions: >= 1 + /// Optional: true + /// Behavior When Optional: Not changed + /// + [JsonPropertyName("fpsDenominator")] + [Key("fpsDenominator")] + public double? FpsDenominator { get; init; } + + /// + /// Numerator of the fractional FPS value + /// + /// + /// Restrictions: >= 1 + /// Optional: true + /// Behavior When Optional: Not changed + /// + [JsonPropertyName("fpsNumerator")] + [Key("fpsNumerator")] + public double? FpsNumerator { get; init; } + + /// + /// Height of the output resolution in pixels + /// + /// + /// Restrictions: >= 1, <= 4096 + /// Optional: true + /// Behavior When Optional: Not changed + /// + [JsonPropertyName("outputHeight")] + [Key("outputHeight")] + public double? OutputHeight { get; init; } + + /// + /// Width of the output resolution in pixels + /// + /// + /// Restrictions: >= 1, <= 4096 + /// Optional: true + /// Behavior When Optional: Not changed + /// + [JsonPropertyName("outputWidth")] + [Key("outputWidth")] + public double? OutputWidth { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SetVideoSettingsRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SetVideoSettingsRequestData(double? fpsNumerator = null, double? fpsDenominator = null, double? baseWidth = null, double? baseHeight = null, double? outputWidth = null, double? outputHeight = null) + { + this.FpsNumerator = fpsNumerator; + this.FpsDenominator = fpsDenominator; + this.BaseWidth = baseWidth; + this.BaseHeight = baseHeight; + this.OutputWidth = outputWidth; + this.OutputHeight = outputHeight; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/Sleep.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/Sleep.Request.g.cs new file mode 100644 index 0000000..02cf715 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/Sleep.Request.g.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the Sleep request. +/// +/// +/// Sleeps for a time duration or number of frames. Only available in request batches with types `SERIAL_REALTIME` or `SERIAL_FRAME`. +/// OBS WebSocket Protocol Category: general | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record SleepRequestData +{ + /// + /// Number of frames to sleep for (if `SERIAL_FRAME` mode) + /// + /// + /// Restrictions: >= 0, <= 10000 + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sleepFrames")] + [Key("sleepFrames")] + public double? SleepFrames { get; init; } + + /// + /// Number of milliseconds to sleep for (if `SERIAL_REALTIME` mode) + /// + /// + /// Restrictions: >= 0, <= 50000 + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("sleepMillis")] + [Key("sleepMillis")] + public double? SleepMillis { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public SleepRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public SleepRequestData(double? sleepMillis = null, double? sleepFrames = null) + { + this.SleepMillis = sleepMillis; + this.SleepFrames = sleepFrames; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/StartOutput.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/StartOutput.Request.g.cs new file mode 100644 index 0000000..ab4c52b --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/StartOutput.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the StartOutput request. +/// +/// +/// Starts an output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record StartOutputRequestData +{ + /// + /// Output name + /// + /// + /// Optional: false + /// + [JsonPropertyName("outputName")] + [Key("outputName")] + public required string OutputName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public StartOutputRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StartOutputRequestData(string outputName) + { + this.OutputName = outputName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/StopOutput.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/StopOutput.Request.g.cs new file mode 100644 index 0000000..63a95a8 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/StopOutput.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the StopOutput request. +/// +/// +/// Stops an output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record StopOutputRequestData +{ + /// + /// Output name + /// + /// + /// Optional: false + /// + [JsonPropertyName("outputName")] + [Key("outputName")] + public required string OutputName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public StopOutputRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public StopOutputRequestData(string outputName) + { + this.OutputName = outputName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/ToggleInputMute.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/ToggleInputMute.Request.g.cs new file mode 100644 index 0000000..abd8a0d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/ToggleInputMute.Request.g.cs @@ -0,0 +1,65 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the ToggleInputMute request. +/// +/// +/// Toggles the audio mute state of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ToggleInputMuteRequestData +{ + /// + /// Name of the input to toggle the mute state of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the input to toggle the mute state of + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ToggleInputMuteRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public ToggleInputMuteRequestData(string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/ToggleOutput.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/ToggleOutput.Request.g.cs new file mode 100644 index 0000000..8c742bb --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/ToggleOutput.Request.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the ToggleOutput request. +/// +/// +/// Toggles the status of an output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ToggleOutputRequestData +{ + /// + /// Output name + /// + /// + /// Optional: false + /// + [JsonPropertyName("outputName")] + [Key("outputName")] + public required string OutputName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ToggleOutputRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToggleOutputRequestData(string outputName) + { + this.OutputName = outputName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/TriggerHotkeyByKeySequence.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/TriggerHotkeyByKeySequence.Request.g.cs new file mode 100644 index 0000000..88c0f3a --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/TriggerHotkeyByKeySequence.Request.g.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the TriggerHotkeyByKeySequence request. +/// +/// +/// Triggers a hotkey using a sequence of keys. +/// +/// Note: Hotkey functionality in obs-websocket comes as-is, and we do not guarantee support if things are broken. In 9/10 usages of hotkey requests, there exists a better, more reliable method via other requests. +/// OBS WebSocket Protocol Category: general | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record TriggerHotkeyByKeySequenceRequestData +{ + /// + /// The OBS key ID to use. See https://github.com/obsproject/obs-studio/blob/master/libobs/obs-hotkeys.h + /// + /// + /// Optional: true + /// Behavior When Optional: Not pressed + /// + [JsonPropertyName("keyId")] + [Key("keyId")] + public string? KeyId { get; init; } + + /// + /// Object containing key modifiers to apply + /// + /// + /// Optional: true + /// Behavior When Optional: Ignored + /// + [JsonPropertyName("keyModifiers")] + [Key("keyModifiers")] + public TriggerHotkeyByKeySequenceRequestData_KeyModifiers? KeyModifiers { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public TriggerHotkeyByKeySequenceRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public TriggerHotkeyByKeySequenceRequestData(string? keyId = null, TriggerHotkeyByKeySequenceRequestData_KeyModifiers? keyModifiers = null) + { + this.KeyId = keyId; + this.KeyModifiers = keyModifiers; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/TriggerHotkeyByName.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/TriggerHotkeyByName.Request.g.cs new file mode 100644 index 0000000..1c4d9ec --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/TriggerHotkeyByName.Request.g.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the TriggerHotkeyByName request. +/// +/// +/// Triggers a hotkey using its name. See `GetHotkeyList`. +/// +/// Note: Hotkey functionality in obs-websocket comes as-is, and we do not guarantee support if things are broken. In 9/10 usages of hotkey requests, there exists a better, more reliable method via other requests. +/// OBS WebSocket Protocol Category: general | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record TriggerHotkeyByNameRequestData +{ + /// + /// Name of context of the hotkey to trigger + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("contextName")] + [Key("contextName")] + public string? ContextName { get; init; } + + /// + /// Name of the hotkey to trigger + /// + /// + /// Optional: false + /// + [JsonPropertyName("hotkeyName")] + [Key("hotkeyName")] + public required string HotkeyName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public TriggerHotkeyByNameRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TriggerHotkeyByNameRequestData(string hotkeyName, string? contextName = null) + { + this.HotkeyName = hotkeyName; + this.ContextName = contextName; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Requests/TriggerMediaInputAction.Request.g.cs b/ObsWebSocket.Core/Generated/Protocol/Requests/TriggerMediaInputAction.Request.g.cs new file mode 100644 index 0000000..b8f067a --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Requests/TriggerMediaInputAction.Request.g.cs @@ -0,0 +1,77 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Requests; + +/// +/// Data required for the TriggerMediaInputAction request. +/// +/// +/// Triggers an action on a media input. +/// OBS WebSocket Protocol Category: media inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record TriggerMediaInputActionRequestData +{ + /// + /// Name of the media input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputName")] + [Key("inputName")] + public string? InputName { get; init; } + + /// + /// UUID of the media input + /// + /// + /// Optional: true + /// Behavior When Optional: Unknown + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// Identifier of the `ObsMediaInputAction` enum + /// + /// + /// Optional: false + /// + [JsonPropertyName("mediaAction")] + [Key("mediaAction")] + public required string MediaAction { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public TriggerMediaInputActionRequestData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public TriggerMediaInputActionRequestData(string mediaAction, string? inputName = null, string? inputUuid = null) + { + this.InputName = inputName; + this.InputUuid = inputUuid; + this.MediaAction = mediaAction; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/CallVendorRequest.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/CallVendorRequest.Response.g.cs new file mode 100644 index 0000000..4db8e0a --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/CallVendorRequest.Response.g.cs @@ -0,0 +1,68 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the CallVendorRequest request. +/// +/// +/// Call a request registered to a vendor. +/// +/// A vendor is a unique name registered by a third-party plugin or script, which allows for custom requests and events to be added to obs-websocket. +/// If a plugin or script implements vendor requests or events, documentation is expected to be provided with them. +/// OBS WebSocket Protocol Category: general | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CallVendorRequestResponseData +{ + /// + /// Echoed of `requestType` + /// + [JsonPropertyName("requestType")] + [Key("requestType")] + public string? RequestType { get; init; } + + /// + /// Object containing appropriate response data. {} if request does not provide any response data + /// + [JsonPropertyName("responseData")] + [Key("responseData")] + public System.Text.Json.JsonElement? ResponseData { get; init; } + + /// + /// Echoed of `vendorName` + /// + [JsonPropertyName("vendorName")] + [Key("vendorName")] + public string? VendorName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CallVendorRequestResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CallVendorRequestResponseData(string? vendorName = null, string? requestType = null, System.Text.Json.JsonElement? responseData = null) + { + this.VendorName = vendorName; + this.RequestType = requestType; + this.ResponseData = responseData; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/CreateInput.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/CreateInput.Response.g.cs new file mode 100644 index 0000000..2f05650 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/CreateInput.Response.g.cs @@ -0,0 +1,58 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the CreateInput request. +/// +/// +/// Creates a new input, adding it as a scene item to the specified scene. +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CreateInputResponseData +{ + /// + /// UUID of the newly created input + /// + [JsonPropertyName("inputUuid")] + [Key("inputUuid")] + public string? InputUuid { get; init; } + + /// + /// ID of the newly created scene item + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CreateInputResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateInputResponseData(double sceneItemId, string? inputUuid = null) + { + this.InputUuid = inputUuid; + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/CreateScene.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/CreateScene.Response.g.cs new file mode 100644 index 0000000..03c84ce --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/CreateScene.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the CreateScene request. +/// +/// +/// Creates a new scene in OBS. +/// OBS WebSocket Protocol Category: scenes | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CreateSceneResponseData +{ + /// + /// UUID of the created scene + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CreateSceneResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public CreateSceneResponseData(string? sceneUuid = null) + { + this.SceneUuid = sceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/CreateSceneItem.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/CreateSceneItem.Response.g.cs new file mode 100644 index 0000000..cfabee0 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/CreateSceneItem.Response.g.cs @@ -0,0 +1,52 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the CreateSceneItem request. +/// +/// +/// Creates a new scene item using a source. +/// +/// Scenes only +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record CreateSceneItemResponseData +{ + /// + /// Numeric ID of the scene item + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public CreateSceneItemResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateSceneItemResponseData(double sceneItemId) + { + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/DuplicateSceneItem.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/DuplicateSceneItem.Response.g.cs new file mode 100644 index 0000000..ecfcf15 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/DuplicateSceneItem.Response.g.cs @@ -0,0 +1,52 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the DuplicateSceneItem request. +/// +/// +/// Duplicates a scene item, copying all transform and crop info. +/// +/// Scenes only +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record DuplicateSceneItemResponseData +{ + /// + /// Numeric ID of the duplicated scene item + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public DuplicateSceneItemResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DuplicateSceneItemResponseData(double sceneItemId) + { + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentPreviewScene.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentPreviewScene.Response.g.cs new file mode 100644 index 0000000..11154ae --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentPreviewScene.Response.g.cs @@ -0,0 +1,77 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetCurrentPreviewScene request. +/// +/// +/// Gets the current preview scene. +/// +/// Only available when studio mode is enabled. +/// +/// Note: This request is slated to have the `currentPreview`-prefixed fields removed from in an upcoming RPC version. +/// OBS WebSocket Protocol Category: scenes | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetCurrentPreviewSceneResponseData +{ + /// + /// Current preview scene name + /// + [JsonPropertyName("currentPreviewSceneName")] + [Key("currentPreviewSceneName")] + public string? CurrentPreviewSceneName { get; init; } + + /// + /// Current preview scene UUID + /// + [JsonPropertyName("currentPreviewSceneUuid")] + [Key("currentPreviewSceneUuid")] + public string? CurrentPreviewSceneUuid { get; init; } + + /// + /// Current preview scene name + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// Current preview scene UUID + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetCurrentPreviewSceneResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetCurrentPreviewSceneResponseData(string? sceneName = null, string? sceneUuid = null, string? currentPreviewSceneName = null, string? currentPreviewSceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.CurrentPreviewSceneName = currentPreviewSceneName; + this.CurrentPreviewSceneUuid = currentPreviewSceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentProgramScene.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentProgramScene.Response.g.cs new file mode 100644 index 0000000..9c2bee4 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentProgramScene.Response.g.cs @@ -0,0 +1,75 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetCurrentProgramScene request. +/// +/// +/// Gets the current program scene. +/// +/// Note: This request is slated to have the `currentProgram`-prefixed fields removed from in an upcoming RPC version. +/// OBS WebSocket Protocol Category: scenes | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetCurrentProgramSceneResponseData +{ + /// + /// Current program scene name (Deprecated) + /// + [JsonPropertyName("currentProgramSceneName")] + [Key("currentProgramSceneName")] + public string? CurrentProgramSceneName { get; init; } + + /// + /// Current program scene UUID (Deprecated) + /// + [JsonPropertyName("currentProgramSceneUuid")] + [Key("currentProgramSceneUuid")] + public string? CurrentProgramSceneUuid { get; init; } + + /// + /// Current program scene name + /// + [JsonPropertyName("sceneName")] + [Key("sceneName")] + public string? SceneName { get; init; } + + /// + /// Current program scene UUID + /// + [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] + public string? SceneUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetCurrentProgramSceneResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetCurrentProgramSceneResponseData(string? sceneName = null, string? sceneUuid = null, string? currentProgramSceneName = null, string? currentProgramSceneUuid = null) + { + this.SceneName = sceneName; + this.SceneUuid = sceneUuid; + this.CurrentProgramSceneName = currentProgramSceneName; + this.CurrentProgramSceneUuid = currentProgramSceneUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentSceneTransition.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentSceneTransition.Response.g.cs new file mode 100644 index 0000000..7cf5a18 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentSceneTransition.Response.g.cs @@ -0,0 +1,98 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetCurrentSceneTransition request. +/// +/// +/// Gets information about the current scene transition. +/// OBS WebSocket Protocol Category: transitions | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetCurrentSceneTransitionResponseData +{ + /// + /// Whether the transition supports being configured + /// + [JsonPropertyName("transitionConfigurable")] + [Key("transitionConfigurable")] + public required bool TransitionConfigurable { get; init; } + + /// + /// Configured transition duration in milliseconds. `null` if transition is fixed + /// + [JsonPropertyName("transitionDuration")] + [Key("transitionDuration")] + public required double TransitionDuration { get; init; } + + /// + /// Whether the transition uses a fixed (unconfigurable) duration + /// + [JsonPropertyName("transitionFixed")] + [Key("transitionFixed")] + public required bool TransitionFixed { get; init; } + + /// + /// Kind of the transition + /// + [JsonPropertyName("transitionKind")] + [Key("transitionKind")] + public string? TransitionKind { get; init; } + + /// + /// Name of the transition + /// + [JsonPropertyName("transitionName")] + [Key("transitionName")] + public string? TransitionName { get; init; } + + /// + /// Object of settings for the transition. `null` if transition is not configurable + /// + [JsonPropertyName("transitionSettings")] + [Key("transitionSettings")] + public System.Text.Json.JsonElement? TransitionSettings { get; init; } + + /// + /// UUID of the transition + /// + [JsonPropertyName("transitionUuid")] + [Key("transitionUuid")] + public string? TransitionUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetCurrentSceneTransitionResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetCurrentSceneTransitionResponseData(bool transitionFixed, double transitionDuration, bool transitionConfigurable, string? transitionName = null, string? transitionUuid = null, string? transitionKind = null, System.Text.Json.JsonElement? transitionSettings = null) + { + this.TransitionName = transitionName; + this.TransitionUuid = transitionUuid; + this.TransitionKind = transitionKind; + this.TransitionFixed = transitionFixed; + this.TransitionDuration = transitionDuration; + this.TransitionConfigurable = transitionConfigurable; + this.TransitionSettings = transitionSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentSceneTransitionCursor.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentSceneTransitionCursor.Response.g.cs new file mode 100644 index 0000000..8fd89de --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetCurrentSceneTransitionCursor.Response.g.cs @@ -0,0 +1,52 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetCurrentSceneTransitionCursor request. +/// +/// +/// Gets the cursor position of the current scene transition. +/// +/// Note: `transitionCursor` will return 1.0 when the transition is inactive. +/// OBS WebSocket Protocol Category: transitions | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetCurrentSceneTransitionCursorResponseData +{ + /// + /// Cursor position, between 0.0 and 1.0 + /// + [JsonPropertyName("transitionCursor")] + [Key("transitionCursor")] + public required double TransitionCursor { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetCurrentSceneTransitionCursorResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetCurrentSceneTransitionCursorResponseData(double transitionCursor) + { + this.TransitionCursor = transitionCursor; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetGroupList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetGroupList.Response.g.cs new file mode 100644 index 0000000..7a59dd6 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetGroupList.Response.g.cs @@ -0,0 +1,51 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetGroupList request. +/// +/// +/// Gets an array of all groups in OBS. +/// +/// Groups in OBS are actually scenes, but renamed and modified. In obs-websocket, we treat them as scenes where we can. +/// OBS WebSocket Protocol Category: scenes | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetGroupListResponseData +{ + /// + /// Array of group names + /// + [JsonPropertyName("groups")] + [Key("groups")] + public System.Collections.Generic.List? Groups { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetGroupListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetGroupListResponseData(System.Collections.Generic.List? groups = null) + { + this.Groups = groups; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetGroupSceneItemList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetGroupSceneItemList.Response.g.cs new file mode 100644 index 0000000..faa6d2a --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetGroupSceneItemList.Response.g.cs @@ -0,0 +1,53 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetGroupSceneItemList request. +/// +/// +/// Basically GetSceneItemList, but for groups. +/// +/// Using groups at all in OBS is discouraged, as they are very broken under the hood. Please use nested scenes instead. +/// +/// Groups only +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetGroupSceneItemListResponseData +{ + /// + /// Array of scene items in the group + /// + [JsonPropertyName("sceneItems")] + [Key("sceneItems")] + public System.Collections.Generic.List? SceneItems { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetGroupSceneItemListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetGroupSceneItemListResponseData(System.Collections.Generic.List? sceneItems = null) + { + this.SceneItems = sceneItems; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetHotkeyList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetHotkeyList.Response.g.cs new file mode 100644 index 0000000..51b51f8 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetHotkeyList.Response.g.cs @@ -0,0 +1,51 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetHotkeyList request. +/// +/// +/// Gets an array of all hotkey names in OBS. +/// +/// Note: Hotkey functionality in obs-websocket comes as-is, and we do not guarantee support if things are broken. In 9/10 usages of hotkey requests, there exists a better, more reliable method via other requests. +/// OBS WebSocket Protocol Category: general | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetHotkeyListResponseData +{ + /// + /// Array of hotkey names + /// + [JsonPropertyName("hotkeys")] + [Key("hotkeys")] + public System.Collections.Generic.List? Hotkeys { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetHotkeyListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetHotkeyListResponseData(System.Collections.Generic.List? hotkeys = null) + { + this.Hotkeys = hotkeys; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioBalance.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioBalance.Response.g.cs new file mode 100644 index 0000000..4e912e6 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioBalance.Response.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputAudioBalance request. +/// +/// +/// Gets the audio balance of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputAudioBalanceResponseData +{ + /// + /// Audio balance value from 0.0-1.0 + /// + [JsonPropertyName("inputAudioBalance")] + [Key("inputAudioBalance")] + public required double InputAudioBalance { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputAudioBalanceResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetInputAudioBalanceResponseData(double inputAudioBalance) + { + this.InputAudioBalance = inputAudioBalance; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioMonitorType.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioMonitorType.Response.g.cs new file mode 100644 index 0000000..530b1fa --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioMonitorType.Response.g.cs @@ -0,0 +1,55 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputAudioMonitorType request. +/// +/// +/// Gets the audio monitor type of an input. +/// +/// The available audio monitor types are: +/// +/// - `OBS_MONITORING_TYPE_NONE` +/// - `OBS_MONITORING_TYPE_MONITOR_ONLY` +/// - `OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT` +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputAudioMonitorTypeResponseData +{ + /// + /// Audio monitor type + /// + [JsonPropertyName("monitorType")] + [Key("monitorType")] + public string? MonitorType { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputAudioMonitorTypeResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputAudioMonitorTypeResponseData(string? monitorType = null) + { + this.MonitorType = monitorType; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioSyncOffset.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioSyncOffset.Response.g.cs new file mode 100644 index 0000000..2d2cb2d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioSyncOffset.Response.g.cs @@ -0,0 +1,52 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputAudioSyncOffset request. +/// +/// +/// Gets the audio sync offset of an input. +/// +/// Note: The audio sync offset can be negative too! +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputAudioSyncOffsetResponseData +{ + /// + /// Audio sync offset in milliseconds + /// + [JsonPropertyName("inputAudioSyncOffset")] + [Key("inputAudioSyncOffset")] + public required double InputAudioSyncOffset { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputAudioSyncOffsetResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetInputAudioSyncOffsetResponseData(double inputAudioSyncOffset) + { + this.InputAudioSyncOffset = inputAudioSyncOffset; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioTracks.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioTracks.Response.g.cs new file mode 100644 index 0000000..3de8e33 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputAudioTracks.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputAudioTracks request. +/// +/// +/// Gets the enable state of all audio tracks of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputAudioTracksResponseData +{ + /// + /// Object of audio tracks and associated enable states + /// + [JsonPropertyName("inputAudioTracks")] + [Key("inputAudioTracks")] + public System.Collections.Generic.Dictionary? InputAudioTracks { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputAudioTracksResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputAudioTracksResponseData(System.Collections.Generic.Dictionary? inputAudioTracks = null) + { + this.InputAudioTracks = inputAudioTracks; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputDefaultSettings.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputDefaultSettings.Response.g.cs new file mode 100644 index 0000000..3cae6e2 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputDefaultSettings.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputDefaultSettings request. +/// +/// +/// Gets the default settings for an input kind. +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputDefaultSettingsResponseData +{ + /// + /// Object of default settings for the input kind + /// + [JsonPropertyName("defaultInputSettings")] + [Key("defaultInputSettings")] + public System.Text.Json.JsonElement? DefaultInputSettings { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputDefaultSettingsResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputDefaultSettingsResponseData(System.Text.Json.JsonElement? defaultInputSettings = null) + { + this.DefaultInputSettings = defaultInputSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputDeinterlaceFieldOrder.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputDeinterlaceFieldOrder.Response.g.cs new file mode 100644 index 0000000..f8d3540 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputDeinterlaceFieldOrder.Response.g.cs @@ -0,0 +1,56 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputDeinterlaceFieldOrder request. +/// +/// +/// Gets the deinterlace field order of an input. +/// +/// Deinterlace Field Orders: +/// +/// - `OBS_DEINTERLACE_FIELD_ORDER_TOP` +/// - `OBS_DEINTERLACE_FIELD_ORDER_BOTTOM` +/// +/// Note: Deinterlacing functionality is restricted to async inputs only. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.6.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputDeinterlaceFieldOrderResponseData +{ + /// + /// Deinterlace field order of the input + /// + [JsonPropertyName("inputDeinterlaceFieldOrder")] + [Key("inputDeinterlaceFieldOrder")] + public string? InputDeinterlaceFieldOrder { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputDeinterlaceFieldOrderResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputDeinterlaceFieldOrderResponseData(string? inputDeinterlaceFieldOrder = null) + { + this.InputDeinterlaceFieldOrder = inputDeinterlaceFieldOrder; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputDeinterlaceMode.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputDeinterlaceMode.Response.g.cs new file mode 100644 index 0000000..81cc25a --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputDeinterlaceMode.Response.g.cs @@ -0,0 +1,63 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputDeinterlaceMode request. +/// +/// +/// Gets the deinterlace mode of an input. +/// +/// Deinterlace Modes: +/// +/// - `OBS_DEINTERLACE_MODE_DISABLE` +/// - `OBS_DEINTERLACE_MODE_DISCARD` +/// - `OBS_DEINTERLACE_MODE_RETRO` +/// - `OBS_DEINTERLACE_MODE_BLEND` +/// - `OBS_DEINTERLACE_MODE_BLEND_2X` +/// - `OBS_DEINTERLACE_MODE_LINEAR` +/// - `OBS_DEINTERLACE_MODE_LINEAR_2X` +/// - `OBS_DEINTERLACE_MODE_YADIF` +/// - `OBS_DEINTERLACE_MODE_YADIF_2X` +/// +/// Note: Deinterlacing functionality is restricted to async inputs only. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.6.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputDeinterlaceModeResponseData +{ + /// + /// Deinterlace mode of the input + /// + [JsonPropertyName("inputDeinterlaceMode")] + [Key("inputDeinterlaceMode")] + public string? InputDeinterlaceMode { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputDeinterlaceModeResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputDeinterlaceModeResponseData(string? inputDeinterlaceMode = null) + { + this.InputDeinterlaceMode = inputDeinterlaceMode; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputKindList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputKindList.Response.g.cs new file mode 100644 index 0000000..d926cd5 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputKindList.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputKindList request. +/// +/// +/// Gets an array of all available input kinds in OBS. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputKindListResponseData +{ + /// + /// Array of input kinds + /// + [JsonPropertyName("inputKinds")] + [Key("inputKinds")] + public System.Collections.Generic.List? InputKinds { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputKindListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputKindListResponseData(System.Collections.Generic.List? inputKinds = null) + { + this.InputKinds = inputKinds; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputList.Response.g.cs new file mode 100644 index 0000000..fe8a6f7 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputList.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputList request. +/// +/// +/// Gets an array of all inputs in OBS. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputListResponseData +{ + /// + /// Array of inputs + /// + [JsonPropertyName("inputs")] + [Key("inputs")] + public System.Collections.Generic.List? Inputs { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputListResponseData(System.Collections.Generic.List? inputs = null) + { + this.Inputs = inputs; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputMute.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputMute.Response.g.cs new file mode 100644 index 0000000..9b98dbd --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputMute.Response.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputMute request. +/// +/// +/// Gets the audio mute state of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputMuteResponseData +{ + /// + /// Whether the input is muted + /// + [JsonPropertyName("inputMuted")] + [Key("inputMuted")] + public required bool InputMuted { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputMuteResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetInputMuteResponseData(bool inputMuted) + { + this.InputMuted = inputMuted; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputPropertiesListPropertyItems.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputPropertiesListPropertyItems.Response.g.cs new file mode 100644 index 0000000..22f90f1 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputPropertiesListPropertyItems.Response.g.cs @@ -0,0 +1,51 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputPropertiesListPropertyItems request. +/// +/// +/// Gets the items of a list property from an input's properties. +/// +/// Note: Use this in cases where an input provides a dynamic, selectable list of items. For example, display capture, where it provides a list of available displays. +/// OBS WebSocket Protocol Category: inputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputPropertiesListPropertyItemsResponseData +{ + /// + /// Array of items in the list property + /// + [JsonPropertyName("propertyItems")] + [Key("propertyItems")] + public System.Collections.Generic.List? PropertyItems { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputPropertiesListPropertyItemsResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputPropertiesListPropertyItemsResponseData(System.Collections.Generic.List? propertyItems = null) + { + this.PropertyItems = propertyItems; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputSettings.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputSettings.Response.g.cs new file mode 100644 index 0000000..bf2cd85 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputSettings.Response.g.cs @@ -0,0 +1,59 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputSettings request. +/// +/// +/// Gets the settings of an input. +/// +/// Note: Does not include defaults. To create the entire settings object, overlay `inputSettings` over the `defaultInputSettings` provided by `GetInputDefaultSettings`. +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputSettingsResponseData +{ + /// + /// The kind of the input + /// + [JsonPropertyName("inputKind")] + [Key("inputKind")] + public string? InputKind { get; init; } + + /// + /// Object of settings for the input + /// + [JsonPropertyName("inputSettings")] + [Key("inputSettings")] + public System.Text.Json.JsonElement? InputSettings { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputSettingsResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetInputSettingsResponseData(System.Text.Json.JsonElement? inputSettings = null, string? inputKind = null) + { + this.InputSettings = inputSettings; + this.InputKind = inputKind; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputVolume.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputVolume.Response.g.cs new file mode 100644 index 0000000..6a96413 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetInputVolume.Response.g.cs @@ -0,0 +1,58 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetInputVolume request. +/// +/// +/// Gets the current volume setting of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetInputVolumeResponseData +{ + /// + /// Volume setting in dB + /// + [JsonPropertyName("inputVolumeDb")] + [Key("inputVolumeDb")] + public required double InputVolumeDb { get; init; } + + /// + /// Volume setting in mul + /// + [JsonPropertyName("inputVolumeMul")] + [Key("inputVolumeMul")] + public required double InputVolumeMul { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetInputVolumeResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetInputVolumeResponseData(double inputVolumeMul, double inputVolumeDb) + { + this.InputVolumeMul = inputVolumeMul; + this.InputVolumeDb = inputVolumeDb; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetLastReplayBufferReplay.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetLastReplayBufferReplay.Response.g.cs new file mode 100644 index 0000000..303f27a --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetLastReplayBufferReplay.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetLastReplayBufferReplay request. +/// +/// +/// Gets the filename of the last replay buffer save file. +/// OBS WebSocket Protocol Category: outputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetLastReplayBufferReplayResponseData +{ + /// + /// File path + /// + [JsonPropertyName("savedReplayPath")] + [Key("savedReplayPath")] + public string? SavedReplayPath { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetLastReplayBufferReplayResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetLastReplayBufferReplayResponseData(string? savedReplayPath = null) + { + this.SavedReplayPath = savedReplayPath; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetMediaInputStatus.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetMediaInputStatus.Response.g.cs new file mode 100644 index 0000000..34446d7 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetMediaInputStatus.Response.g.cs @@ -0,0 +1,77 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetMediaInputStatus request. +/// +/// +/// Gets the status of a media input. +/// +/// Media States: +/// +/// - `OBS_MEDIA_STATE_NONE` +/// - `OBS_MEDIA_STATE_PLAYING` +/// - `OBS_MEDIA_STATE_OPENING` +/// - `OBS_MEDIA_STATE_BUFFERING` +/// - `OBS_MEDIA_STATE_PAUSED` +/// - `OBS_MEDIA_STATE_STOPPED` +/// - `OBS_MEDIA_STATE_ENDED` +/// - `OBS_MEDIA_STATE_ERROR` +/// OBS WebSocket Protocol Category: media inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetMediaInputStatusResponseData +{ + /// + /// Position of the cursor in milliseconds. `null` if not playing + /// + [JsonPropertyName("mediaCursor")] + [Key("mediaCursor")] + public required double MediaCursor { get; init; } + + /// + /// Total duration of the playing media in milliseconds. `null` if not playing + /// + [JsonPropertyName("mediaDuration")] + [Key("mediaDuration")] + public required double MediaDuration { get; init; } + + /// + /// State of the media input + /// + [JsonPropertyName("mediaState")] + [Key("mediaState")] + public string? MediaState { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetMediaInputStatusResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetMediaInputStatusResponseData(double mediaDuration, double mediaCursor, string? mediaState = null) + { + this.MediaState = mediaState; + this.MediaDuration = mediaDuration; + this.MediaCursor = mediaCursor; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetMonitorList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetMonitorList.Response.g.cs new file mode 100644 index 0000000..c7bf0ae --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetMonitorList.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetMonitorList request. +/// +/// +/// Gets a list of connected monitors and information about them. +/// OBS WebSocket Protocol Category: ui | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetMonitorListResponseData +{ + /// + /// a list of detected monitors with some information + /// + [JsonPropertyName("monitors")] + [Key("monitors")] + public System.Collections.Generic.List? Monitors { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetMonitorListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetMonitorListResponseData(System.Collections.Generic.List? monitors = null) + { + this.Monitors = monitors; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetOutputList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetOutputList.Response.g.cs new file mode 100644 index 0000000..f09911e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetOutputList.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetOutputList request. +/// +/// +/// Gets the list of available outputs. +/// OBS WebSocket Protocol Category: outputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetOutputListResponseData +{ + /// + /// Array of outputs + /// + [JsonPropertyName("outputs")] + [Key("outputs")] + public System.Collections.Generic.List? Outputs { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetOutputListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetOutputListResponseData(System.Collections.Generic.List? outputs = null) + { + this.Outputs = outputs; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetOutputSettings.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetOutputSettings.Response.g.cs new file mode 100644 index 0000000..6f7aff4 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetOutputSettings.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetOutputSettings request. +/// +/// +/// Gets the settings of an output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetOutputSettingsResponseData +{ + /// + /// Output settings + /// + [JsonPropertyName("outputSettings")] + [Key("outputSettings")] + public System.Text.Json.JsonElement? OutputSettings { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetOutputSettingsResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetOutputSettingsResponseData(System.Text.Json.JsonElement? outputSettings = null) + { + this.OutputSettings = outputSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetOutputStatus.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetOutputStatus.Response.g.cs new file mode 100644 index 0000000..edec618 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetOutputStatus.Response.g.cs @@ -0,0 +1,106 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetOutputStatus request. +/// +/// +/// Gets the status of an output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetOutputStatusResponseData +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// + /// Number of bytes sent by the output + /// + [JsonPropertyName("outputBytes")] + [Key("outputBytes")] + public required double OutputBytes { get; init; } + + /// + /// Congestion of the output + /// + [JsonPropertyName("outputCongestion")] + [Key("outputCongestion")] + public required double OutputCongestion { get; init; } + + /// + /// Current duration in milliseconds for the output + /// + [JsonPropertyName("outputDuration")] + [Key("outputDuration")] + public required double OutputDuration { get; init; } + + /// + /// Whether the output is reconnecting + /// + [JsonPropertyName("outputReconnecting")] + [Key("outputReconnecting")] + public required bool OutputReconnecting { get; init; } + + /// + /// Number of frames skipped by the output's process + /// + [JsonPropertyName("outputSkippedFrames")] + [Key("outputSkippedFrames")] + public required double OutputSkippedFrames { get; init; } + + /// + /// Current formatted timecode string for the output + /// + [JsonPropertyName("outputTimecode")] + [Key("outputTimecode")] + public string? OutputTimecode { get; init; } + + /// + /// Total number of frames delivered by the output's process + /// + [JsonPropertyName("outputTotalFrames")] + [Key("outputTotalFrames")] + public required double OutputTotalFrames { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetOutputStatusResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetOutputStatusResponseData(bool outputActive, bool outputReconnecting, double outputDuration, double outputCongestion, double outputBytes, double outputSkippedFrames, double outputTotalFrames, string? outputTimecode = null) + { + this.OutputActive = outputActive; + this.OutputReconnecting = outputReconnecting; + this.OutputTimecode = outputTimecode; + this.OutputDuration = outputDuration; + this.OutputCongestion = outputCongestion; + this.OutputBytes = outputBytes; + this.OutputSkippedFrames = outputSkippedFrames; + this.OutputTotalFrames = outputTotalFrames; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetPersistentData.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetPersistentData.Response.g.cs new file mode 100644 index 0000000..123f822 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetPersistentData.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetPersistentData request. +/// +/// +/// Gets the value of a "slot" from the selected persistent data realm. +/// OBS WebSocket Protocol Category: config | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetPersistentDataResponseData +{ + /// + /// Value associated with the slot. `null` if not set + /// + [JsonPropertyName("slotValue")] + [Key("slotValue")] + public System.Text.Json.JsonElement? SlotValue { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetPersistentDataResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetPersistentDataResponseData(System.Text.Json.JsonElement? slotValue = null) + { + this.SlotValue = slotValue; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetProfileList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetProfileList.Response.g.cs new file mode 100644 index 0000000..cbf1325 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetProfileList.Response.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetProfileList request. +/// +/// +/// Gets an array of all profiles +/// OBS WebSocket Protocol Category: config | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetProfileListResponseData +{ + /// + /// The name of the current profile + /// + [JsonPropertyName("currentProfileName")] + [Key("currentProfileName")] + public string? CurrentProfileName { get; init; } + + /// + /// Array of all available profiles + /// + [JsonPropertyName("profiles")] + [Key("profiles")] + public System.Collections.Generic.List? Profiles { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetProfileListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetProfileListResponseData(string? currentProfileName = null, System.Collections.Generic.List? profiles = null) + { + this.CurrentProfileName = currentProfileName; + this.Profiles = profiles; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetProfileParameter.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetProfileParameter.Response.g.cs new file mode 100644 index 0000000..c036fa6 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetProfileParameter.Response.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetProfileParameter request. +/// +/// +/// Gets a parameter from the current profile's configuration. +/// OBS WebSocket Protocol Category: config | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetProfileParameterResponseData +{ + /// + /// Default value associated with the parameter. `null` if no default + /// + [JsonPropertyName("defaultParameterValue")] + [Key("defaultParameterValue")] + public string? DefaultParameterValue { get; init; } + + /// + /// Value associated with the parameter. `null` if not set and no default + /// + [JsonPropertyName("parameterValue")] + [Key("parameterValue")] + public string? ParameterValue { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetProfileParameterResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetProfileParameterResponseData(string? parameterValue = null, string? defaultParameterValue = null) + { + this.ParameterValue = parameterValue; + this.DefaultParameterValue = defaultParameterValue; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetRecordDirectory.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetRecordDirectory.Response.g.cs new file mode 100644 index 0000000..7a0a39f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetRecordDirectory.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetRecordDirectory request. +/// +/// +/// Gets the current directory that the record output is set to. +/// OBS WebSocket Protocol Category: config | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetRecordDirectoryResponseData +{ + /// + /// Output directory + /// + [JsonPropertyName("recordDirectory")] + [Key("recordDirectory")] + public string? RecordDirectory { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetRecordDirectoryResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetRecordDirectoryResponseData(string? recordDirectory = null) + { + this.RecordDirectory = recordDirectory; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetRecordStatus.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetRecordStatus.Response.g.cs new file mode 100644 index 0000000..0737846 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetRecordStatus.Response.g.cs @@ -0,0 +1,82 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetRecordStatus request. +/// +/// +/// Gets the status of the record output. +/// OBS WebSocket Protocol Category: record | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetRecordStatusResponseData +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// + /// Number of bytes sent by the output + /// + [JsonPropertyName("outputBytes")] + [Key("outputBytes")] + public required double OutputBytes { get; init; } + + /// + /// Current duration in milliseconds for the output + /// + [JsonPropertyName("outputDuration")] + [Key("outputDuration")] + public required double OutputDuration { get; init; } + + /// + /// Whether the output is paused + /// + [JsonPropertyName("outputPaused")] + [Key("outputPaused")] + public required bool OutputPaused { get; init; } + + /// + /// Current formatted timecode string for the output + /// + [JsonPropertyName("outputTimecode")] + [Key("outputTimecode")] + public string? OutputTimecode { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetRecordStatusResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetRecordStatusResponseData(bool outputActive, bool outputPaused, double outputDuration, double outputBytes, string? outputTimecode = null) + { + this.OutputActive = outputActive; + this.OutputPaused = outputPaused; + this.OutputTimecode = outputTimecode; + this.OutputDuration = outputDuration; + this.OutputBytes = outputBytes; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetReplayBufferStatus.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetReplayBufferStatus.Response.g.cs new file mode 100644 index 0000000..cb31557 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetReplayBufferStatus.Response.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetReplayBufferStatus request. +/// +/// +/// Gets the status of the replay buffer output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetReplayBufferStatusResponseData +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetReplayBufferStatusResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetReplayBufferStatusResponseData(bool outputActive) + { + this.OutputActive = outputActive; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneCollectionList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneCollectionList.Response.g.cs new file mode 100644 index 0000000..43feb17 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneCollectionList.Response.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneCollectionList request. +/// +/// +/// Gets an array of all scene collections +/// OBS WebSocket Protocol Category: config | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneCollectionListResponseData +{ + /// + /// The name of the current scene collection + /// + [JsonPropertyName("currentSceneCollectionName")] + [Key("currentSceneCollectionName")] + public string? CurrentSceneCollectionName { get; init; } + + /// + /// Array of all available scene collections + /// + [JsonPropertyName("sceneCollections")] + [Key("sceneCollections")] + public System.Collections.Generic.List? SceneCollections { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneCollectionListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSceneCollectionListResponseData(string? currentSceneCollectionName = null, System.Collections.Generic.List? sceneCollections = null) + { + this.CurrentSceneCollectionName = currentSceneCollectionName; + this.SceneCollections = sceneCollections; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemBlendMode.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemBlendMode.Response.g.cs new file mode 100644 index 0000000..9b835d9 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemBlendMode.Response.g.cs @@ -0,0 +1,61 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneItemBlendMode request. +/// +/// +/// Gets the blend mode of a scene item. +/// +/// Blend modes: +/// +/// - `OBS_BLEND_NORMAL` +/// - `OBS_BLEND_ADDITIVE` +/// - `OBS_BLEND_SUBTRACT` +/// - `OBS_BLEND_SCREEN` +/// - `OBS_BLEND_MULTIPLY` +/// - `OBS_BLEND_LIGHTEN` +/// - `OBS_BLEND_DARKEN` +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemBlendModeResponseData +{ + /// + /// Current blend mode + /// + [JsonPropertyName("sceneItemBlendMode")] + [Key("sceneItemBlendMode")] + public string? SceneItemBlendMode { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemBlendModeResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSceneItemBlendModeResponseData(string? sceneItemBlendMode = null) + { + this.SceneItemBlendMode = sceneItemBlendMode; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemEnabled.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemEnabled.Response.g.cs new file mode 100644 index 0000000..e276a29 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemEnabled.Response.g.cs @@ -0,0 +1,52 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneItemEnabled request. +/// +/// +/// Gets the enable state of a scene item. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemEnabledResponseData +{ + /// + /// Whether the scene item is enabled. `true` for enabled, `false` for disabled + /// + [JsonPropertyName("sceneItemEnabled")] + [Key("sceneItemEnabled")] + public required bool SceneItemEnabled { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemEnabledResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneItemEnabledResponseData(bool sceneItemEnabled) + { + this.SceneItemEnabled = sceneItemEnabled; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemId.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemId.Response.g.cs new file mode 100644 index 0000000..af48b22 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemId.Response.g.cs @@ -0,0 +1,52 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneItemId request. +/// +/// +/// Searches a scene for a source, and returns its id. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemIdResponseData +{ + /// + /// Numeric ID of the scene item + /// + [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] + public required double SceneItemId { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemIdResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneItemIdResponseData(double sceneItemId) + { + this.SceneItemId = sceneItemId; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemIndex.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemIndex.Response.g.cs new file mode 100644 index 0000000..e6e0c80 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemIndex.Response.g.cs @@ -0,0 +1,54 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneItemIndex request. +/// +/// +/// Gets the index position of a scene item in a scene. +/// +/// An index of 0 is at the bottom of the source list in the UI. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemIndexResponseData +{ + /// + /// Index position of the scene item + /// + [JsonPropertyName("sceneItemIndex")] + [Key("sceneItemIndex")] + public required double SceneItemIndex { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemIndexResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneItemIndexResponseData(double sceneItemIndex) + { + this.SceneItemIndex = sceneItemIndex; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemList.Response.g.cs new file mode 100644 index 0000000..6e5f373 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemList.Response.g.cs @@ -0,0 +1,51 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneItemList request. +/// +/// +/// Gets a list of all scene items in a scene. +/// +/// Scenes only +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemListResponseData +{ + /// + /// Array of scene items in the scene + /// + [JsonPropertyName("sceneItems")] + [Key("sceneItems")] + public System.Collections.Generic.List? SceneItems { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSceneItemListResponseData(System.Collections.Generic.List? sceneItems = null) + { + this.SceneItems = sceneItems; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemLocked.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemLocked.Response.g.cs new file mode 100644 index 0000000..5725d11 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemLocked.Response.g.cs @@ -0,0 +1,52 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneItemLocked request. +/// +/// +/// Gets the lock state of a scene item. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemLockedResponseData +{ + /// + /// Whether the scene item is locked. `true` for locked, `false` for unlocked + /// + [JsonPropertyName("sceneItemLocked")] + [Key("sceneItemLocked")] + public required bool SceneItemLocked { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemLockedResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneItemLockedResponseData(bool sceneItemLocked) + { + this.SceneItemLocked = sceneItemLocked; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemSource.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemSource.Response.g.cs new file mode 100644 index 0000000..16eb829 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemSource.Response.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneItemSource request. +/// +/// +/// Gets the source associated with a scene item. +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.4.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemSourceResponseData +{ + /// + /// Name of the source associated with the scene item + /// + [JsonPropertyName("sourceName")] + [Key("sourceName")] + public string? SourceName { get; init; } + + /// + /// UUID of the source associated with the scene item + /// + [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] + public string? SourceUuid { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemSourceResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSceneItemSourceResponseData(string? sourceName = null, string? sourceUuid = null) + { + this.SourceName = sourceName; + this.SourceUuid = sourceUuid; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemTransform.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemTransform.Response.g.cs new file mode 100644 index 0000000..3a58313 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneItemTransform.Response.g.cs @@ -0,0 +1,51 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneItemTransform request. +/// +/// +/// Gets the transform and crop info of a scene item. +/// +/// Scenes and Groups +/// OBS WebSocket Protocol Category: scene items | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneItemTransformResponseData +{ + /// + /// Object containing scene item transform info + /// + [JsonPropertyName("sceneItemTransform")] + [Key("sceneItemTransform")] + public ObsWebSocket.Core.Protocol.Common.SceneItemTransformStub? SceneItemTransform { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneItemTransformResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSceneItemTransformResponseData(ObsWebSocket.Core.Protocol.Common.SceneItemTransformStub? sceneItemTransform = null) + { + this.SceneItemTransform = sceneItemTransform; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneList.Response.g.cs new file mode 100644 index 0000000..0d5eac5 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneList.Response.g.cs @@ -0,0 +1,81 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneList request. +/// +/// +/// Gets an array of all scenes in OBS. +/// OBS WebSocket Protocol Category: scenes | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneListResponseData +{ + /// + /// Current preview scene name. `null` if not in studio mode + /// + [JsonPropertyName("currentPreviewSceneName")] + [Key("currentPreviewSceneName")] + public string? CurrentPreviewSceneName { get; init; } + + /// + /// Current preview scene UUID. `null` if not in studio mode + /// + [JsonPropertyName("currentPreviewSceneUuid")] + [Key("currentPreviewSceneUuid")] + public string? CurrentPreviewSceneUuid { get; init; } + + /// + /// Current program scene name. Can be `null` if internal state desync + /// + [JsonPropertyName("currentProgramSceneName")] + [Key("currentProgramSceneName")] + public string? CurrentProgramSceneName { get; init; } + + /// + /// Current program scene UUID. Can be `null` if internal state desync + /// + [JsonPropertyName("currentProgramSceneUuid")] + [Key("currentProgramSceneUuid")] + public string? CurrentProgramSceneUuid { get; init; } + + /// + /// Array of scenes + /// + [JsonPropertyName("scenes")] + [Key("scenes")] + public System.Collections.Generic.List? Scenes { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSceneListResponseData(string? currentProgramSceneName = null, string? currentProgramSceneUuid = null, string? currentPreviewSceneName = null, string? currentPreviewSceneUuid = null, System.Collections.Generic.List? scenes = null) + { + this.CurrentProgramSceneName = currentProgramSceneName; + this.CurrentProgramSceneUuid = currentProgramSceneUuid; + this.CurrentPreviewSceneName = currentPreviewSceneName; + this.CurrentPreviewSceneUuid = currentPreviewSceneUuid; + this.Scenes = scenes; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneSceneTransitionOverride.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneSceneTransitionOverride.Response.g.cs new file mode 100644 index 0000000..53c3681 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneSceneTransitionOverride.Response.g.cs @@ -0,0 +1,60 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneSceneTransitionOverride request. +/// +/// +/// Gets the scene transition overridden for a scene. +/// +/// Note: A transition UUID response field is not currently able to be implemented as of 2024-1-18. +/// OBS WebSocket Protocol Category: scenes | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneSceneTransitionOverrideResponseData +{ + /// + /// Duration of the overridden scene transition, else `null` + /// + [JsonPropertyName("transitionDuration")] + [Key("transitionDuration")] + public required double TransitionDuration { get; init; } + + /// + /// Name of the overridden scene transition, else `null` + /// + [JsonPropertyName("transitionName")] + [Key("transitionName")] + public string? TransitionName { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneSceneTransitionOverrideResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSceneSceneTransitionOverrideResponseData(double transitionDuration, string? transitionName = null) + { + this.TransitionName = transitionName; + this.TransitionDuration = transitionDuration; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneTransitionList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneTransitionList.Response.g.cs new file mode 100644 index 0000000..ea28080 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSceneTransitionList.Response.g.cs @@ -0,0 +1,73 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSceneTransitionList request. +/// +/// +/// Gets an array of all scene transitions in OBS. +/// OBS WebSocket Protocol Category: transitions | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSceneTransitionListResponseData +{ + /// + /// Kind of the current scene transition. Can be null + /// + [JsonPropertyName("currentSceneTransitionKind")] + [Key("currentSceneTransitionKind")] + public string? CurrentSceneTransitionKind { get; init; } + + /// + /// Name of the current scene transition. Can be null + /// + [JsonPropertyName("currentSceneTransitionName")] + [Key("currentSceneTransitionName")] + public string? CurrentSceneTransitionName { get; init; } + + /// + /// UUID of the current scene transition. Can be null + /// + [JsonPropertyName("currentSceneTransitionUuid")] + [Key("currentSceneTransitionUuid")] + public string? CurrentSceneTransitionUuid { get; init; } + + /// + /// Array of transitions + /// + [JsonPropertyName("transitions")] + [Key("transitions")] + public System.Collections.Generic.List? Transitions { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSceneTransitionListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSceneTransitionListResponseData(string? currentSceneTransitionName = null, string? currentSceneTransitionUuid = null, string? currentSceneTransitionKind = null, System.Collections.Generic.List? transitions = null) + { + this.CurrentSceneTransitionName = currentSceneTransitionName; + this.CurrentSceneTransitionUuid = currentSceneTransitionUuid; + this.CurrentSceneTransitionKind = currentSceneTransitionKind; + this.Transitions = transitions; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceActive.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceActive.Response.g.cs new file mode 100644 index 0000000..dff6b88 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceActive.Response.g.cs @@ -0,0 +1,60 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSourceActive request. +/// +/// +/// Gets the active and show state of a source. +/// +/// **Compatible with inputs and scenes.** +/// OBS WebSocket Protocol Category: sources | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSourceActiveResponseData +{ + /// + /// Whether the source is showing in Program + /// + [JsonPropertyName("videoActive")] + [Key("videoActive")] + public required bool VideoActive { get; init; } + + /// + /// Whether the source is showing in the UI (Preview, Projector, Properties) + /// + [JsonPropertyName("videoShowing")] + [Key("videoShowing")] + public required bool VideoShowing { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSourceActiveResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSourceActiveResponseData(bool videoActive, bool videoShowing) + { + this.VideoActive = videoActive; + this.VideoShowing = videoShowing; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilter.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilter.Response.g.cs new file mode 100644 index 0000000..8cba357 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilter.Response.g.cs @@ -0,0 +1,74 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSourceFilter request. +/// +/// +/// Gets the info for a specific source filter. +/// OBS WebSocket Protocol Category: filters | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSourceFilterResponseData +{ + /// + /// Whether the filter is enabled + /// + [JsonPropertyName("filterEnabled")] + [Key("filterEnabled")] + public required bool FilterEnabled { get; init; } + + /// + /// Index of the filter in the list, beginning at 0 + /// + [JsonPropertyName("filterIndex")] + [Key("filterIndex")] + public required double FilterIndex { get; init; } + + /// + /// The kind of filter + /// + [JsonPropertyName("filterKind")] + [Key("filterKind")] + public string? FilterKind { get; init; } + + /// + /// Settings object associated with the filter + /// + [JsonPropertyName("filterSettings")] + [Key("filterSettings")] + public System.Text.Json.JsonElement? FilterSettings { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSourceFilterResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetSourceFilterResponseData(bool filterEnabled, double filterIndex, string? filterKind = null, System.Text.Json.JsonElement? filterSettings = null) + { + this.FilterEnabled = filterEnabled; + this.FilterIndex = filterIndex; + this.FilterKind = filterKind; + this.FilterSettings = filterSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilterDefaultSettings.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilterDefaultSettings.Response.g.cs new file mode 100644 index 0000000..baec898 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilterDefaultSettings.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSourceFilterDefaultSettings request. +/// +/// +/// Gets the default settings for a filter kind. +/// OBS WebSocket Protocol Category: filters | Complexity: 3/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSourceFilterDefaultSettingsResponseData +{ + /// + /// Object of default settings for the filter kind + /// + [JsonPropertyName("defaultFilterSettings")] + [Key("defaultFilterSettings")] + public System.Text.Json.JsonElement? DefaultFilterSettings { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSourceFilterDefaultSettingsResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSourceFilterDefaultSettingsResponseData(System.Text.Json.JsonElement? defaultFilterSettings = null) + { + this.DefaultFilterSettings = defaultFilterSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilterKindList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilterKindList.Response.g.cs new file mode 100644 index 0000000..7e3c343 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilterKindList.Response.g.cs @@ -0,0 +1,51 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSourceFilterKindList request. +/// +/// +/// Gets an array of all available source filter kinds. +/// +/// Similar to `GetInputKindList` +/// OBS WebSocket Protocol Category: filters | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.4.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSourceFilterKindListResponseData +{ + /// + /// Array of source filter kinds + /// + [JsonPropertyName("sourceFilterKinds")] + [Key("sourceFilterKinds")] + public System.Collections.Generic.List? SourceFilterKinds { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSourceFilterKindListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSourceFilterKindListResponseData(System.Collections.Generic.List? sourceFilterKinds = null) + { + this.SourceFilterKinds = sourceFilterKinds; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilterList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilterList.Response.g.cs new file mode 100644 index 0000000..c45922f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceFilterList.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSourceFilterList request. +/// +/// +/// Gets an array of all of a source's filters. +/// OBS WebSocket Protocol Category: filters | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSourceFilterListResponseData +{ + /// + /// Array of filters + /// + [JsonPropertyName("filters")] + [Key("filters")] + public System.Collections.Generic.List? Filters { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSourceFilterListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSourceFilterListResponseData(System.Collections.Generic.List? filters = null) + { + this.Filters = filters; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceScreenshot.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceScreenshot.Response.g.cs new file mode 100644 index 0000000..f055243 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSourceScreenshot.Response.g.cs @@ -0,0 +1,54 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSourceScreenshot request. +/// +/// +/// Gets a Base64-encoded screenshot of a source. +/// +/// The `imageWidth` and `imageHeight` parameters are treated as "scale to inner", meaning the smallest ratio will be used and the aspect ratio of the original resolution is kept. +/// If `imageWidth` and `imageHeight` are not specified, the compressed image will use the full resolution of the source. +/// +/// **Compatible with inputs and scenes.** +/// OBS WebSocket Protocol Category: sources | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSourceScreenshotResponseData +{ + /// + /// Base64-encoded screenshot + /// + [JsonPropertyName("imageData")] + [Key("imageData")] + public string? ImageData { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSourceScreenshotResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSourceScreenshotResponseData(string? imageData = null) + { + this.ImageData = imageData; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetSpecialInputs.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSpecialInputs.Response.g.cs new file mode 100644 index 0000000..714b455 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetSpecialInputs.Response.g.cs @@ -0,0 +1,89 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetSpecialInputs request. +/// +/// +/// Gets the names of all special inputs. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetSpecialInputsResponseData +{ + /// + /// Name of the Desktop Audio input + /// + [JsonPropertyName("desktop1")] + [Key("desktop1")] + public string? Desktop1 { get; init; } + + /// + /// Name of the Desktop Audio 2 input + /// + [JsonPropertyName("desktop2")] + [Key("desktop2")] + public string? Desktop2 { get; init; } + + /// + /// Name of the Mic/Auxiliary Audio input + /// + [JsonPropertyName("mic1")] + [Key("mic1")] + public string? Mic1 { get; init; } + + /// + /// Name of the Mic/Auxiliary Audio 2 input + /// + [JsonPropertyName("mic2")] + [Key("mic2")] + public string? Mic2 { get; init; } + + /// + /// Name of the Mic/Auxiliary Audio 3 input + /// + [JsonPropertyName("mic3")] + [Key("mic3")] + public string? Mic3 { get; init; } + + /// + /// Name of the Mic/Auxiliary Audio 4 input + /// + [JsonPropertyName("mic4")] + [Key("mic4")] + public string? Mic4 { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetSpecialInputsResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetSpecialInputsResponseData(string? desktop1 = null, string? desktop2 = null, string? mic1 = null, string? mic2 = null, string? mic3 = null, string? mic4 = null) + { + this.Desktop1 = desktop1; + this.Desktop2 = desktop2; + this.Mic1 = mic1; + this.Mic2 = mic2; + this.Mic3 = mic3; + this.Mic4 = mic4; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetStats.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetStats.Response.g.cs new file mode 100644 index 0000000..0942964 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetStats.Response.g.cs @@ -0,0 +1,130 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetStats request. +/// +/// +/// Gets statistics about OBS, obs-websocket, and the current session. +/// OBS WebSocket Protocol Category: general | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetStatsResponseData +{ + /// + /// Current FPS being rendered + /// + [JsonPropertyName("activeFps")] + [Key("activeFps")] + public required double ActiveFps { get; init; } + + /// + /// Available disk space on the device being used for recording storage + /// + [JsonPropertyName("availableDiskSpace")] + [Key("availableDiskSpace")] + public required double AvailableDiskSpace { get; init; } + + /// + /// Average time in milliseconds that OBS is taking to render a frame + /// + [JsonPropertyName("averageFrameRenderTime")] + [Key("averageFrameRenderTime")] + public required double AverageFrameRenderTime { get; init; } + + /// + /// Current CPU usage in percent + /// + [JsonPropertyName("cpuUsage")] + [Key("cpuUsage")] + public required double CpuUsage { get; init; } + + /// + /// Amount of memory in MB currently being used by OBS + /// + [JsonPropertyName("memoryUsage")] + [Key("memoryUsage")] + public required double MemoryUsage { get; init; } + + /// + /// Number of frames skipped by OBS in the output thread + /// + [JsonPropertyName("outputSkippedFrames")] + [Key("outputSkippedFrames")] + public required double OutputSkippedFrames { get; init; } + + /// + /// Total number of frames outputted by the output thread + /// + [JsonPropertyName("outputTotalFrames")] + [Key("outputTotalFrames")] + public required double OutputTotalFrames { get; init; } + + /// + /// Number of frames skipped by OBS in the render thread + /// + [JsonPropertyName("renderSkippedFrames")] + [Key("renderSkippedFrames")] + public required double RenderSkippedFrames { get; init; } + + /// + /// Total number of frames outputted by the render thread + /// + [JsonPropertyName("renderTotalFrames")] + [Key("renderTotalFrames")] + public required double RenderTotalFrames { get; init; } + + /// + /// Total number of messages received by obs-websocket from the client + /// + [JsonPropertyName("webSocketSessionIncomingMessages")] + [Key("webSocketSessionIncomingMessages")] + public required double WebSocketSessionIncomingMessages { get; init; } + + /// + /// Total number of messages sent by obs-websocket to the client + /// + [JsonPropertyName("webSocketSessionOutgoingMessages")] + [Key("webSocketSessionOutgoingMessages")] + public required double WebSocketSessionOutgoingMessages { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetStatsResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetStatsResponseData(double cpuUsage, double memoryUsage, double availableDiskSpace, double activeFps, double averageFrameRenderTime, double renderSkippedFrames, double renderTotalFrames, double outputSkippedFrames, double outputTotalFrames, double webSocketSessionIncomingMessages, double webSocketSessionOutgoingMessages) + { + this.CpuUsage = cpuUsage; + this.MemoryUsage = memoryUsage; + this.AvailableDiskSpace = availableDiskSpace; + this.ActiveFps = activeFps; + this.AverageFrameRenderTime = averageFrameRenderTime; + this.RenderSkippedFrames = renderSkippedFrames; + this.RenderTotalFrames = renderTotalFrames; + this.OutputSkippedFrames = outputSkippedFrames; + this.OutputTotalFrames = outputTotalFrames; + this.WebSocketSessionIncomingMessages = webSocketSessionIncomingMessages; + this.WebSocketSessionOutgoingMessages = webSocketSessionOutgoingMessages; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetStreamServiceSettings.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetStreamServiceSettings.Response.g.cs new file mode 100644 index 0000000..387481f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetStreamServiceSettings.Response.g.cs @@ -0,0 +1,57 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetStreamServiceSettings request. +/// +/// +/// Gets the current stream service settings (stream destination). +/// OBS WebSocket Protocol Category: config | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetStreamServiceSettingsResponseData +{ + /// + /// Stream service settings + /// + [JsonPropertyName("streamServiceSettings")] + [Key("streamServiceSettings")] + public System.Text.Json.JsonElement? StreamServiceSettings { get; init; } + + /// + /// Stream service type, like `rtmp_custom` or `rtmp_common` + /// + [JsonPropertyName("streamServiceType")] + [Key("streamServiceType")] + public string? StreamServiceType { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetStreamServiceSettingsResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetStreamServiceSettingsResponseData(string? streamServiceType = null, System.Text.Json.JsonElement? streamServiceSettings = null) + { + this.StreamServiceType = streamServiceType; + this.StreamServiceSettings = streamServiceSettings; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetStreamStatus.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetStreamStatus.Response.g.cs new file mode 100644 index 0000000..52d0d65 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetStreamStatus.Response.g.cs @@ -0,0 +1,106 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetStreamStatus request. +/// +/// +/// Gets the status of the stream output. +/// OBS WebSocket Protocol Category: stream | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetStreamStatusResponseData +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// + /// Number of bytes sent by the output + /// + [JsonPropertyName("outputBytes")] + [Key("outputBytes")] + public required double OutputBytes { get; init; } + + /// + /// Congestion of the output + /// + [JsonPropertyName("outputCongestion")] + [Key("outputCongestion")] + public required double OutputCongestion { get; init; } + + /// + /// Current duration in milliseconds for the output + /// + [JsonPropertyName("outputDuration")] + [Key("outputDuration")] + public required double OutputDuration { get; init; } + + /// + /// Whether the output is currently reconnecting + /// + [JsonPropertyName("outputReconnecting")] + [Key("outputReconnecting")] + public required bool OutputReconnecting { get; init; } + + /// + /// Number of frames skipped by the output's process + /// + [JsonPropertyName("outputSkippedFrames")] + [Key("outputSkippedFrames")] + public required double OutputSkippedFrames { get; init; } + + /// + /// Current formatted timecode string for the output + /// + [JsonPropertyName("outputTimecode")] + [Key("outputTimecode")] + public string? OutputTimecode { get; init; } + + /// + /// Total number of frames delivered by the output's process + /// + [JsonPropertyName("outputTotalFrames")] + [Key("outputTotalFrames")] + public required double OutputTotalFrames { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetStreamStatusResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetStreamStatusResponseData(bool outputActive, bool outputReconnecting, double outputDuration, double outputCongestion, double outputBytes, double outputSkippedFrames, double outputTotalFrames, string? outputTimecode = null) + { + this.OutputActive = outputActive; + this.OutputReconnecting = outputReconnecting; + this.OutputTimecode = outputTimecode; + this.OutputDuration = outputDuration; + this.OutputCongestion = outputCongestion; + this.OutputBytes = outputBytes; + this.OutputSkippedFrames = outputSkippedFrames; + this.OutputTotalFrames = outputTotalFrames; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetStudioModeEnabled.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetStudioModeEnabled.Response.g.cs new file mode 100644 index 0000000..1380d34 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetStudioModeEnabled.Response.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetStudioModeEnabled request. +/// +/// +/// Gets whether studio is enabled. +/// OBS WebSocket Protocol Category: ui | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetStudioModeEnabledResponseData +{ + /// + /// Whether studio mode is enabled + /// + [JsonPropertyName("studioModeEnabled")] + [Key("studioModeEnabled")] + public required bool StudioModeEnabled { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetStudioModeEnabledResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetStudioModeEnabledResponseData(bool studioModeEnabled) + { + this.StudioModeEnabled = studioModeEnabled; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetTransitionKindList.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetTransitionKindList.Response.g.cs new file mode 100644 index 0000000..e68225d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetTransitionKindList.Response.g.cs @@ -0,0 +1,51 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetTransitionKindList request. +/// +/// +/// Gets an array of all available transition kinds. +/// +/// Similar to `GetInputKindList` +/// OBS WebSocket Protocol Category: transitions | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetTransitionKindListResponseData +{ + /// + /// Array of transition kinds + /// + [JsonPropertyName("transitionKinds")] + [Key("transitionKinds")] + public System.Collections.Generic.List? TransitionKinds { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetTransitionKindListResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public GetTransitionKindListResponseData(System.Collections.Generic.List? transitionKinds = null) + { + this.TransitionKinds = transitionKinds; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetVersion.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetVersion.Response.g.cs new file mode 100644 index 0000000..c8b120f --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetVersion.Response.g.cs @@ -0,0 +1,98 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetVersion request. +/// +/// +/// Gets data about the current plugin and RPC version. +/// OBS WebSocket Protocol Category: general | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetVersionResponseData +{ + /// + /// Array of available RPC requests for the currently negotiated RPC version + /// + [JsonPropertyName("availableRequests")] + [Key("availableRequests")] + public System.Collections.Generic.List? AvailableRequests { get; init; } + + /// + /// Current OBS Studio version + /// + [JsonPropertyName("obsVersion")] + [Key("obsVersion")] + public string? ObsVersion { get; init; } + + /// + /// Current obs-websocket version + /// + [JsonPropertyName("obsWebSocketVersion")] + [Key("obsWebSocketVersion")] + public string? ObsWebSocketVersion { get; init; } + + /// + /// Name of the platform. Usually `windows`, `macos`, or `ubuntu` (linux flavor). Not guaranteed to be any of those + /// + [JsonPropertyName("platform")] + [Key("platform")] + public string? Platform { get; init; } + + /// + /// Description of the platform, like `Windows 10 (10.0)` + /// + [JsonPropertyName("platformDescription")] + [Key("platformDescription")] + public string? PlatformDescription { get; init; } + + /// + /// Current latest obs-websocket RPC version + /// + [JsonPropertyName("rpcVersion")] + [Key("rpcVersion")] + public required double RpcVersion { get; init; } + + /// + /// Image formats available in `GetSourceScreenshot` and `SaveSourceScreenshot` requests. + /// + [JsonPropertyName("supportedImageFormats")] + [Key("supportedImageFormats")] + public System.Collections.Generic.List? SupportedImageFormats { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetVersionResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetVersionResponseData(double rpcVersion, string? obsVersion = null, string? obsWebSocketVersion = null, System.Collections.Generic.List? availableRequests = null, System.Collections.Generic.List? supportedImageFormats = null, string? platform = null, string? platformDescription = null) + { + this.ObsVersion = obsVersion; + this.ObsWebSocketVersion = obsWebSocketVersion; + this.RpcVersion = rpcVersion; + this.AvailableRequests = availableRequests; + this.SupportedImageFormats = supportedImageFormats; + this.Platform = platform; + this.PlatformDescription = platformDescription; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetVideoSettings.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetVideoSettings.Response.g.cs new file mode 100644 index 0000000..7fab887 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetVideoSettings.Response.g.cs @@ -0,0 +1,92 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetVideoSettings request. +/// +/// +/// Gets the current video settings. +/// +/// Note: To get the true FPS value, divide the FPS numerator by the FPS denominator. Example: `60000/1001` +/// OBS WebSocket Protocol Category: config | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetVideoSettingsResponseData +{ + /// + /// Height of the base (canvas) resolution in pixels + /// + [JsonPropertyName("baseHeight")] + [Key("baseHeight")] + public required double BaseHeight { get; init; } + + /// + /// Width of the base (canvas) resolution in pixels + /// + [JsonPropertyName("baseWidth")] + [Key("baseWidth")] + public required double BaseWidth { get; init; } + + /// + /// Denominator of the fractional FPS value + /// + [JsonPropertyName("fpsDenominator")] + [Key("fpsDenominator")] + public required double FpsDenominator { get; init; } + + /// + /// Numerator of the fractional FPS value + /// + [JsonPropertyName("fpsNumerator")] + [Key("fpsNumerator")] + public required double FpsNumerator { get; init; } + + /// + /// Height of the output resolution in pixels + /// + [JsonPropertyName("outputHeight")] + [Key("outputHeight")] + public required double OutputHeight { get; init; } + + /// + /// Width of the output resolution in pixels + /// + [JsonPropertyName("outputWidth")] + [Key("outputWidth")] + public required double OutputWidth { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetVideoSettingsResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetVideoSettingsResponseData(double fpsNumerator, double fpsDenominator, double baseWidth, double baseHeight, double outputWidth, double outputHeight) + { + this.FpsNumerator = fpsNumerator; + this.FpsDenominator = fpsDenominator; + this.BaseWidth = baseWidth; + this.BaseHeight = baseHeight; + this.OutputWidth = outputWidth; + this.OutputHeight = outputHeight; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/GetVirtualCamStatus.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/GetVirtualCamStatus.Response.g.cs new file mode 100644 index 0000000..c193582 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/GetVirtualCamStatus.Response.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the GetVirtualCamStatus request. +/// +/// +/// Gets the status of the virtualcam output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record GetVirtualCamStatusResponseData +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public GetVirtualCamStatusResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GetVirtualCamStatusResponseData(bool outputActive) + { + this.OutputActive = outputActive; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/StopRecord.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/StopRecord.Response.g.cs new file mode 100644 index 0000000..04d885d --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/StopRecord.Response.g.cs @@ -0,0 +1,49 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the StopRecord request. +/// +/// +/// Stops the record output. +/// OBS WebSocket Protocol Category: record | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record StopRecordResponseData +{ + /// + /// File name for the saved recording + /// + [JsonPropertyName("outputPath")] + [Key("outputPath")] + public string? OutputPath { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public StopRecordResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + public StopRecordResponseData(string? outputPath = null) + { + this.OutputPath = outputPath; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleInputMute.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleInputMute.Response.g.cs new file mode 100644 index 0000000..f30b3c8 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleInputMute.Response.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the ToggleInputMute request. +/// +/// +/// Toggles the audio mute state of an input. +/// OBS WebSocket Protocol Category: inputs | Complexity: 2/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ToggleInputMuteResponseData +{ + /// + /// Whether the input has been muted or unmuted + /// + [JsonPropertyName("inputMuted")] + [Key("inputMuted")] + public required bool InputMuted { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ToggleInputMuteResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToggleInputMuteResponseData(bool inputMuted) + { + this.InputMuted = inputMuted; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleOutput.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleOutput.Response.g.cs new file mode 100644 index 0000000..908b023 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleOutput.Response.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the ToggleOutput request. +/// +/// +/// Toggles the status of an output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 4/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ToggleOutputResponseData +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ToggleOutputResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToggleOutputResponseData(bool outputActive) + { + this.OutputActive = outputActive; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleRecord.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleRecord.Response.g.cs new file mode 100644 index 0000000..47d2064 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleRecord.Response.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the ToggleRecord request. +/// +/// +/// Toggles the status of the record output. +/// OBS WebSocket Protocol Category: record | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ToggleRecordResponseData +{ + /// + /// The new active state of the output + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ToggleRecordResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToggleRecordResponseData(bool outputActive) + { + this.OutputActive = outputActive; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleReplayBuffer.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleReplayBuffer.Response.g.cs new file mode 100644 index 0000000..e93f3b6 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleReplayBuffer.Response.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the ToggleReplayBuffer request. +/// +/// +/// Toggles the state of the replay buffer output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ToggleReplayBufferResponseData +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ToggleReplayBufferResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToggleReplayBufferResponseData(bool outputActive) + { + this.OutputActive = outputActive; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleStream.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleStream.Response.g.cs new file mode 100644 index 0000000..f0aa025 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleStream.Response.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the ToggleStream request. +/// +/// +/// Toggles the status of the stream output. +/// OBS WebSocket Protocol Category: stream | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ToggleStreamResponseData +{ + /// + /// New state of the stream output + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ToggleStreamResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToggleStreamResponseData(bool outputActive) + { + this.OutputActive = outputActive; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleVirtualCam.Response.g.cs b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleVirtualCam.Response.g.cs new file mode 100644 index 0000000..21da62c --- /dev/null +++ b/ObsWebSocket.Core/Generated/Protocol/Responses/ToggleVirtualCam.Response.g.cs @@ -0,0 +1,50 @@ +// +#nullable enable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Diagnostics.CodeAnalysis; +using MessagePack; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Common.NestedTypes; + +namespace ObsWebSocket.Core.Protocol.Responses; + +/// +/// Data returned by the ToggleVirtualCam request. +/// +/// +/// Toggles the state of the virtualcam output. +/// OBS WebSocket Protocol Category: outputs | Complexity: 1/5 +/// RPC Version: 1 | Initial OBS WebSocket Version: 5.0.0 +/// Generated from obs-websocket protocol definition. +#pragma warning disable CS8618 +[MessagePackObject] +public sealed partial record ToggleVirtualCamResponseData +{ + /// + /// Whether the output is active + /// + [JsonPropertyName("outputActive")] + [Key("outputActive")] + public required bool OutputActive { get; init; } + + /// Initializes a new instance for deserialization via . + [JsonConstructor] + public ToggleVirtualCamResponseData() { } + + /// + /// Initializes a new instance with all properties specified. + /// Parameters are ordered with required properties first, then optional properties (with defaults). Follows protocol definition order where possible. + /// + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToggleVirtualCamResponseData(bool outputActive) + { + this.OutputActive = outputActive; + } + +} +#pragma warning restore CS8618 + diff --git a/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketJsonContext.g.cs b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketJsonContext.g.cs new file mode 100644 index 0000000..379e27e --- /dev/null +++ b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketJsonContext.g.cs @@ -0,0 +1,275 @@ +// +// Serialization Context: ObsWebSocketJsonContext +#nullable enable + +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using ObsWebSocket.Core.Protocol; +using ObsWebSocket.Core.Protocol.Common; +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Protocol.Requests; +using ObsWebSocket.Core.Protocol.Responses; + +namespace ObsWebSocket.Core.Serialization; + +[JsonSourceGenerationOptions( + PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault)] +[JsonSerializable(typeof(OutgoingMessage))] +[JsonSerializable(typeof(OutgoingMessage))] +[JsonSerializable(typeof(OutgoingMessage))] +[JsonSerializable(typeof(OutgoingMessage))] +[JsonSerializable(typeof(IncomingMessage))] +[JsonSerializable(typeof(RequestResponsePayload))] +[JsonSerializable(typeof(RequestBatchResponsePayload))] +[JsonSerializable(typeof(EventPayloadBase))] +[JsonSerializable(typeof(HelloPayload))] +[JsonSerializable(typeof(IdentifiedPayload))] +[JsonSerializable(typeof(RequestStatus))] +[JsonSerializable(typeof(SceneStub))] +[JsonSerializable(typeof(SceneItemStub))] +[JsonSerializable(typeof(SceneItemTransformStub))] +[JsonSerializable(typeof(FilterStub))] +[JsonSerializable(typeof(InputStub))] +[JsonSerializable(typeof(TransitionStub))] +[JsonSerializable(typeof(OutputStub))] +[JsonSerializable(typeof(MonitorStub))] +[JsonSerializable(typeof(PropertyItemStub))] +[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(List>))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetPersistentDataRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetPersistentDataResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetPersistentDataRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneCollectionListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneCollectionRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.CreateSceneCollectionRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetProfileListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentProfileRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.CreateProfileRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.RemoveProfileRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetProfileParameterRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetProfileParameterResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetProfileParameterRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetVideoSettingsResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetVideoSettingsRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetStreamServiceSettingsResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetStreamServiceSettingsRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetRecordDirectoryResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetRecordDirectoryRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceFilterKindListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSourceFilterListRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceFilterListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSourceFilterDefaultSettingsRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceFilterDefaultSettingsResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.CreateSourceFilterRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.RemoveSourceFilterRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetSourceFilterNameRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSourceFilterRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceFilterResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetSourceFilterIndexRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetSourceFilterSettingsRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetSourceFilterEnabledRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetVersionResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetStatsResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.BroadcastCustomEventRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.CallVendorRequestRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.CallVendorRequestResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetHotkeyListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.TriggerHotkeyByNameRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.TriggerHotkeyByKeySequenceRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SleepRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputListRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputKindListRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputKindListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSpecialInputsResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.CreateInputRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.CreateInputResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.RemoveInputRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetInputNameRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputDefaultSettingsRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputDefaultSettingsResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputSettingsRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputSettingsResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetInputSettingsRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputMuteRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputMuteResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetInputMuteRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.ToggleInputMuteRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.ToggleInputMuteResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputVolumeRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputVolumeResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetInputVolumeRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputAudioBalanceRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputAudioBalanceResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetInputAudioBalanceRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputAudioSyncOffsetRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputAudioSyncOffsetResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetInputAudioSyncOffsetRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputAudioMonitorTypeRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputAudioMonitorTypeResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetInputAudioMonitorTypeRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputAudioTracksRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputAudioTracksResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetInputAudioTracksRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputDeinterlaceModeRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputDeinterlaceModeResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetInputDeinterlaceModeRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputDeinterlaceFieldOrderRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputDeinterlaceFieldOrderResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetInputDeinterlaceFieldOrderRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetInputPropertiesListPropertyItemsRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetInputPropertiesListPropertyItemsResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.PressInputPropertiesButtonRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetMediaInputStatusRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetMediaInputStatusResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetMediaInputCursorRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.OffsetMediaInputCursorRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.TriggerMediaInputActionRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetVirtualCamStatusResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.ToggleVirtualCamResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetReplayBufferStatusResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.ToggleReplayBufferResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetLastReplayBufferReplayResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetOutputListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetOutputStatusRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetOutputStatusResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.ToggleOutputRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.ToggleOutputResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.StartOutputRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.StopOutputRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetOutputSettingsRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetOutputSettingsResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetOutputSettingsRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetRecordStatusResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.ToggleRecordResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.StopRecordResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.CreateRecordChapterRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemListRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetGroupSceneItemListRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetGroupSceneItemListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemIdRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemIdResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemSourceRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemSourceResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.CreateSceneItemRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.CreateSceneItemResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.RemoveSceneItemRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.DuplicateSceneItemRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.DuplicateSceneItemResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemTransformRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemTransformResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneItemTransformRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemEnabledRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemEnabledResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneItemEnabledRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemLockedRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemLockedResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneItemLockedRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemIndexRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemIndexResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneItemIndexRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemBlendModeRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemBlendModeResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneItemBlendModeRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetGroupListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetCurrentProgramSceneResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentProgramSceneRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetCurrentPreviewSceneResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentPreviewSceneRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.CreateSceneRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.CreateSceneResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.RemoveSceneRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneNameRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneSceneTransitionOverrideRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneSceneTransitionOverrideResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneSceneTransitionOverrideRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSourceActiveRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceActiveResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.GetSourceScreenshotRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceScreenshotResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SaveSourceScreenshotRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetStreamStatusResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.ToggleStreamResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SendStreamCaptionRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetTransitionKindListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneTransitionListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetCurrentSceneTransitionResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneTransitionRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneTransitionDurationRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneTransitionSettingsRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetCurrentSceneTransitionCursorResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetTBarPositionRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetStudioModeEnabledResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.SetStudioModeEnabledRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.OpenInputPropertiesDialogRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.OpenInputFiltersDialogRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.OpenInputInteractDialogRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Responses.GetMonitorListResponseData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.OpenVideoMixProjectorRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Requests.OpenSourceProjectorRequestData))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.CurrentSceneCollectionChangingPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.CurrentSceneCollectionChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneCollectionListChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.CurrentProfileChangingPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.CurrentProfileChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.ProfileListChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterListReindexedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterCreatedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterRemovedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterNameChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterSettingsChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterEnableStateChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputCreatedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputRemovedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputNameChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputSettingsChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputActiveStateChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputShowStateChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputMuteStateChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputVolumeChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputAudioBalanceChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputAudioSyncOffsetChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputAudioTracksChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputAudioMonitorTypeChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.InputVolumeMetersPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.MediaInputPlaybackStartedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.MediaInputPlaybackEndedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.MediaInputActionTriggeredPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.StreamStateChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.RecordStateChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.RecordFileChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.ReplayBufferStateChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.VirtualcamStateChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.ReplayBufferSavedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneItemCreatedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneItemRemovedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneItemListReindexedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneItemEnableStateChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneItemLockStateChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneItemSelectedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneItemTransformChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneCreatedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneRemovedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneNameChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.CurrentProgramSceneChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.CurrentPreviewSceneChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneListChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.CurrentSceneTransitionChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.CurrentSceneTransitionDurationChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneTransitionStartedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneTransitionEndedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.SceneTransitionVideoEndedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.StudioModeStateChangedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.ScreenshotSavedPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.VendorEventPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Events.CustomEventPayload))] +[JsonSerializable(typeof(ObsWebSocket.Core.Protocol.Common.NestedTypes.TriggerHotkeyByKeySequenceRequestData_KeyModifiers))] +internal sealed partial class ObsWebSocketJsonContext : JsonSerializerContext +{ +} diff --git a/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.EventTypes.g.cs b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.EventTypes.g.cs new file mode 100644 index 0000000..71c77a7 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.EventTypes.g.cs @@ -0,0 +1,71 @@ +// +// Serialization Resolver Type Map +#nullable enable + +using System; + +namespace ObsWebSocket.Core.Serialization; + +internal static partial class ObsWebSocketMsgPackResolverCore +{ + private static partial bool IsEventType(Type type) + { + return + type == typeof(ObsWebSocket.Core.Protocol.Events.CurrentSceneCollectionChangingPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.CurrentSceneCollectionChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneCollectionListChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.CurrentProfileChangingPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.CurrentProfileChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.ProfileListChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterListReindexedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterCreatedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterRemovedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterNameChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterSettingsChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SourceFilterEnableStateChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputCreatedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputRemovedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputNameChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputSettingsChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputActiveStateChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputShowStateChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputMuteStateChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputVolumeChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputAudioBalanceChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputAudioSyncOffsetChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputAudioTracksChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputAudioMonitorTypeChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.InputVolumeMetersPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.MediaInputPlaybackStartedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.MediaInputPlaybackEndedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.MediaInputActionTriggeredPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.StreamStateChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.RecordStateChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.RecordFileChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.ReplayBufferStateChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.VirtualcamStateChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.ReplayBufferSavedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneItemCreatedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneItemRemovedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneItemListReindexedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneItemEnableStateChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneItemLockStateChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneItemSelectedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneItemTransformChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneCreatedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneRemovedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneNameChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.CurrentProgramSceneChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.CurrentPreviewSceneChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneListChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.CurrentSceneTransitionChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.CurrentSceneTransitionDurationChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneTransitionStartedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneTransitionEndedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.SceneTransitionVideoEndedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.StudioModeStateChangedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.ScreenshotSavedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.VendorEventPayload) || + type == typeof(ObsWebSocket.Core.Protocol.Events.CustomEventPayload); + } +} diff --git a/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.FixedTypes.g.cs b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.FixedTypes.g.cs new file mode 100644 index 0000000..354c912 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.FixedTypes.g.cs @@ -0,0 +1,23 @@ +// +// Serialization Resolver Type Map +#nullable enable + +using System; + +namespace ObsWebSocket.Core.Serialization; + +internal static partial class ObsWebSocketMsgPackResolverCore +{ + private static partial bool IsFixedType(Type type) + { + return + type == typeof(ObsWebSocket.Core.Protocol.HelloPayload) || + type == typeof(ObsWebSocket.Core.Protocol.AuthenticationData) || + type == typeof(ObsWebSocket.Core.Protocol.IdentifyPayload) || + type == typeof(ObsWebSocket.Core.Protocol.IdentifiedPayload) || + type == typeof(ObsWebSocket.Core.Protocol.ReidentifyPayload) || + type == typeof(ObsWebSocket.Core.Protocol.RequestPayload) || + type == typeof(ObsWebSocket.Core.Protocol.RequestBatchPayload) || + type == typeof(ObsWebSocket.Core.Protocol.RequestStatus); + } +} diff --git a/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.NestedTypes.g.cs b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.NestedTypes.g.cs new file mode 100644 index 0000000..a07fbc2 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.NestedTypes.g.cs @@ -0,0 +1,16 @@ +// +// Serialization Resolver Type Map +#nullable enable + +using System; + +namespace ObsWebSocket.Core.Serialization; + +internal static partial class ObsWebSocketMsgPackResolverCore +{ + private static partial bool IsNestedType(Type type) + { + return + type == typeof(ObsWebSocket.Core.Protocol.Common.NestedTypes.TriggerHotkeyByKeySequenceRequestData_KeyModifiers); + } +} diff --git a/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.RequestTypes.g.cs b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.RequestTypes.g.cs new file mode 100644 index 0000000..15f8914 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.RequestTypes.g.cs @@ -0,0 +1,117 @@ +// +// Serialization Resolver Type Map +#nullable enable + +using System; + +namespace ObsWebSocket.Core.Serialization; + +internal static partial class ObsWebSocketMsgPackResolverCore +{ + private static partial bool IsRequestType(Type type) + { + return + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetPersistentDataRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetPersistentDataRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneCollectionRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.CreateSceneCollectionRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentProfileRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.CreateProfileRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.RemoveProfileRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetProfileParameterRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetProfileParameterRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetVideoSettingsRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetStreamServiceSettingsRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetRecordDirectoryRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSourceFilterListRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSourceFilterDefaultSettingsRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.CreateSourceFilterRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.RemoveSourceFilterRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetSourceFilterNameRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSourceFilterRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetSourceFilterIndexRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetSourceFilterSettingsRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetSourceFilterEnabledRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.BroadcastCustomEventRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.CallVendorRequestRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.TriggerHotkeyByNameRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.TriggerHotkeyByKeySequenceRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SleepRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputListRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputKindListRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.CreateInputRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.RemoveInputRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetInputNameRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputDefaultSettingsRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputSettingsRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetInputSettingsRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputMuteRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetInputMuteRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.ToggleInputMuteRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputVolumeRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetInputVolumeRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputAudioBalanceRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetInputAudioBalanceRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputAudioSyncOffsetRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetInputAudioSyncOffsetRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputAudioMonitorTypeRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetInputAudioMonitorTypeRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputAudioTracksRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetInputAudioTracksRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputDeinterlaceModeRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetInputDeinterlaceModeRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputDeinterlaceFieldOrderRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetInputDeinterlaceFieldOrderRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetInputPropertiesListPropertyItemsRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.PressInputPropertiesButtonRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetMediaInputStatusRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetMediaInputCursorRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.OffsetMediaInputCursorRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.TriggerMediaInputActionRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetOutputStatusRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.ToggleOutputRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.StartOutputRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.StopOutputRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetOutputSettingsRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetOutputSettingsRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.CreateRecordChapterRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemListRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetGroupSceneItemListRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemIdRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemSourceRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.CreateSceneItemRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.RemoveSceneItemRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.DuplicateSceneItemRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemTransformRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneItemTransformRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemEnabledRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneItemEnabledRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemLockedRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneItemLockedRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemIndexRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneItemIndexRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneItemBlendModeRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneItemBlendModeRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentProgramSceneRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentPreviewSceneRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.CreateSceneRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.RemoveSceneRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneNameRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSceneSceneTransitionOverrideRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetSceneSceneTransitionOverrideRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSourceActiveRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.GetSourceScreenshotRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SaveSourceScreenshotRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SendStreamCaptionRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneTransitionRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneTransitionDurationRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetCurrentSceneTransitionSettingsRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetTBarPositionRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.SetStudioModeEnabledRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.OpenInputPropertiesDialogRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.OpenInputFiltersDialogRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.OpenInputInteractDialogRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.OpenVideoMixProjectorRequestData) || + type == typeof(ObsWebSocket.Core.Protocol.Requests.OpenSourceProjectorRequestData); + } +} diff --git a/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.ResponseTypes.g.cs b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.ResponseTypes.g.cs new file mode 100644 index 0000000..94d3365 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.ResponseTypes.g.cs @@ -0,0 +1,86 @@ +// +// Serialization Resolver Type Map +#nullable enable + +using System; + +namespace ObsWebSocket.Core.Serialization; + +internal static partial class ObsWebSocketMsgPackResolverCore +{ + private static partial bool IsResponseType(Type type) + { + return + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetPersistentDataResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneCollectionListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetProfileListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetProfileParameterResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetVideoSettingsResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetStreamServiceSettingsResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetRecordDirectoryResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceFilterKindListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceFilterListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceFilterDefaultSettingsResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceFilterResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetVersionResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetStatsResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.CallVendorRequestResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetHotkeyListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputKindListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSpecialInputsResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.CreateInputResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputDefaultSettingsResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputSettingsResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputMuteResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.ToggleInputMuteResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputVolumeResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputAudioBalanceResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputAudioSyncOffsetResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputAudioMonitorTypeResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputAudioTracksResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputDeinterlaceModeResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputDeinterlaceFieldOrderResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetInputPropertiesListPropertyItemsResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetMediaInputStatusResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetVirtualCamStatusResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.ToggleVirtualCamResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetReplayBufferStatusResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.ToggleReplayBufferResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetLastReplayBufferReplayResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetOutputListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetOutputStatusResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.ToggleOutputResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetOutputSettingsResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetRecordStatusResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.ToggleRecordResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.StopRecordResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetGroupSceneItemListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemIdResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemSourceResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.CreateSceneItemResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.DuplicateSceneItemResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemTransformResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemEnabledResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemLockedResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemIndexResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneItemBlendModeResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetGroupListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetCurrentProgramSceneResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetCurrentPreviewSceneResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.CreateSceneResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneSceneTransitionOverrideResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceActiveResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSourceScreenshotResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetStreamStatusResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.ToggleStreamResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetTransitionKindListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetSceneTransitionListResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetCurrentSceneTransitionResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetCurrentSceneTransitionCursorResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetStudioModeEnabledResponseData) || + type == typeof(ObsWebSocket.Core.Protocol.Responses.GetMonitorListResponseData); + } +} diff --git a/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.g.cs b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.g.cs new file mode 100644 index 0000000..0136433 --- /dev/null +++ b/ObsWebSocket.Core/Generated/Serialization/ObsWebSocketMsgPackResolver.g.cs @@ -0,0 +1,53 @@ +// +// Serialization Resolver: ObsWebSocketMsgPackResolver +#nullable enable + +using System; +using MessagePack; +using MessagePack.Formatters; +using MessagePack.Resolvers; + +namespace ObsWebSocket.Core.Serialization; + +/// +/// MessagePack resolver for OBS WebSocket protocol DTOs. +/// +public sealed class ObsWebSocketMsgPackResolver : IFormatterResolver +{ + /// + /// Singleton resolver instance. + /// + public static readonly IFormatterResolver Instance = new ObsWebSocketMsgPackResolver(); + + private ObsWebSocketMsgPackResolver() { } + + /// + /// Gets a formatter for when this resolver supports it. + /// + public IMessagePackFormatter? GetFormatter() => ObsWebSocketMsgPackResolverCore.GetFormatter(); +} + +internal static partial class ObsWebSocketMsgPackResolverCore +{ + public static IMessagePackFormatter? GetFormatter() + { + Type type = typeof(T); + if (!IsKnownType(type)) + { + return null; + } + + return SourceGeneratedFormatterResolver.Instance.GetFormatter(); + } + + private static bool IsKnownType(Type type) + { + return IsFixedType(type) || IsRequestType(type) || IsResponseType(type) || IsEventType(type) || IsNestedType(type); + } + + private static partial bool IsFixedType(Type type); + private static partial bool IsRequestType(Type type); + private static partial bool IsResponseType(Type type); + private static partial bool IsEventType(Type type); + private static partial bool IsNestedType(Type type); +} diff --git a/ObsWebSocket.Core/ObsWebSocket.Core.csproj b/ObsWebSocket.Core/ObsWebSocket.Core.csproj index b238938..967f760 100644 --- a/ObsWebSocket.Core/ObsWebSocket.Core.csproj +++ b/ObsWebSocket.Core/ObsWebSocket.Core.csproj @@ -1,6 +1,6 @@  - net9.0 + net10.0;net9.0 enable enable latest @@ -9,7 +9,7 @@ ObsWebSocket.Core Agash Agash - A modern .NET 9 / C# 13 library for interacting with the OBS Studio WebSocket v5 API, featuring source generation for protocol types and DI support. + A modern .NET 10 / C# 14 library for interacting with the OBS Studio WebSocket v5 API, featuring source generation for protocol types and DI support. Copyright (c) Agash 2025 https://github.com/Agash/ObsWebSocket https://github.com/Agash/ObsWebSocket.git @@ -28,39 +28,74 @@ snupkg - true + true - - - - - - + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers - - - - - + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\ObsWebSocket.Codegen.Tasks\ObsWebSocket.Codegen.Tasks.csproj')) + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\ObsWebSocket.Codegen.Tasks\bin\$(Configuration)\net9.0\ObsWebSocket.Codegen.Tasks.dll')) + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\protocol.json')) + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)Generated')) + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)Generated\Serialization\ObsWebSocketJsonContext.g.cs')) + + + + - + + + + + true + + + + + + + + + + diff --git a/ObsWebSocket.Core/ObsWebSocketClient.Helper.cs b/ObsWebSocket.Core/ObsWebSocketClient.Helper.cs index d7cf973..d37379d 100644 --- a/ObsWebSocket.Core/ObsWebSocketClient.Helper.cs +++ b/ObsWebSocket.Core/ObsWebSocketClient.Helper.cs @@ -1,4 +1,6 @@ -using System.Text.Json; +using System.Buffers; +using System.Text.Json; +using System.Text.Json.Serialization.Metadata; using Microsoft.Extensions.Logging; using ObsWebSocket.Core.Events; using ObsWebSocket.Core.Events.Generated; @@ -14,9 +16,8 @@ namespace ObsWebSocket.Core; // Or ObsWebSocket.Core.Extensions /// public static partial class ObsWebSocketClientHelpers { - private static readonly JsonSerializerOptions s_helperJsonOptions = new( - JsonSerializerDefaults.Web - ); + private static readonly JsonSerializerOptions s_helperJsonOptions = + ObsWebSocket.Core.Serialization.ObsWebSocketJsonContext.Default.Options; /// /// Switches the active Program or Preview scene, optionally setting a specific transition and duration beforehand. @@ -264,12 +265,18 @@ public static async Task SetInputTextAsync( try { - // Create the minimal settings object OBS expects for text sources - var settingsPayload = new { text }; - JsonElement settingsElement = JsonSerializer.SerializeToElement( - settingsPayload, - s_helperJsonOptions - ); + // Create the minimal settings payload without reflection-driven serialization. + ArrayBufferWriter buffer = new(); + using (Utf8JsonWriter writer = new(buffer)) + { + writer.WriteStartObject(); + writer.WriteString("text", text); + writer.WriteEndObject(); + writer.Flush(); + } + + using JsonDocument settingsDocument = JsonDocument.Parse(buffer.WrittenMemory); + JsonElement settingsElement = settingsDocument.RootElement.Clone(); await client .SetInputSettingsAsync( @@ -616,7 +623,19 @@ public static async Task SetSceneItemEnabledAsync( try { - return filterInfo.FilterSettings.Value.Deserialize(s_helperJsonOptions); + JsonTypeInfo typeInfo = (JsonTypeInfo)s_helperJsonOptions.GetTypeInfo(typeof(T)); + return filterInfo.FilterSettings.Value.Deserialize(typeInfo); + } + catch (InvalidOperationException invalidOperationException) + { + client._logger.LogError( + invalidOperationException, + "Type {TypeName} is not registered in ObsWebSocketJsonContext. Filter settings deserialization for '{FilterName}' on '{SourceName}' requires source-generated metadata for AOT compatibility.", + typeof(T).Name, + filterName, + sourceName + ); + return null; } catch (JsonException jsonEx) { @@ -674,7 +693,15 @@ public static async Task SetSourceFilterSettingsAsync( JsonElement settingsElement; try { - settingsElement = JsonSerializer.SerializeToElement(settings, s_helperJsonOptions); + JsonTypeInfo typeInfo = (JsonTypeInfo)s_helperJsonOptions.GetTypeInfo(typeof(T)); + settingsElement = JsonSerializer.SerializeToElement(settings, typeInfo); + } + catch (InvalidOperationException invalidOperationException) + { + throw new ObsWebSocketException( + $"Failed to serialize settings object of type '{typeof(T).Name}' for filter '{filterName}'. Type is not registered in ObsWebSocketJsonContext.", + invalidOperationException + ); } catch (JsonException jsonEx) { @@ -1015,3 +1042,5 @@ public SceneItemNotFoundException(string message, Exception inner) : base(message, inner) { } } } + + diff --git a/ObsWebSocket.Core/ObsWebSocketClient.cs b/ObsWebSocket.Core/ObsWebSocketClient.cs index 5f819cf..38e08f0 100644 --- a/ObsWebSocket.Core/ObsWebSocketClient.cs +++ b/ObsWebSocket.Core/ObsWebSocketClient.cs @@ -103,9 +103,8 @@ private readonly ConcurrentDictionary< TaskCreationOptions.RunContinuationsAsynchronously ); - private static readonly JsonSerializerOptions s_payloadJsonOptions = new( - JsonSerializerDefaults.Web - ); + private static readonly JsonSerializerOptions s_payloadJsonOptions = + ObsWebSocket.Core.Serialization.ObsWebSocketJsonContext.Default.Options; #endregion #region Properties @@ -288,7 +287,7 @@ await SendMessageAsync( when (ex is not OperationCanceledException || cancellationToken.IsCancellationRequested) { _logger.LogError(ex, "ReidentifyAsync failed."); - _identifiedTcs?.TrySetException(ex); + _ = (_identifiedTcs?.TrySetException(ex)); throw ex is ObsWebSocketException or OperationCanceledException ? ex : new ObsWebSocketException($"Reidentify failed: {ex.Message}", ex); @@ -296,7 +295,7 @@ await SendMessageAsync( catch (OperationCanceledException) when (_clientLifetimeCts.IsCancellationRequested) { _logger.LogWarning("ReidentifyAsync canceled due to client shutdown."); - _identifiedTcs?.TrySetCanceled(_clientLifetimeCts.Token); + _ = (_identifiedTcs?.TrySetCanceled(_clientLifetimeCts.Token)); throw; } finally @@ -398,7 +397,7 @@ await SendMessageAsync( requestId ); - tcs.TrySetException(ex); // Ensure TCS is completed on failure + _ = tcs.TrySetException(ex); // Ensure TCS is completed on failure throw; } @@ -410,13 +409,13 @@ await SendMessageAsync( requestId ); - tcs.TrySetCanceled(_clientLifetimeCts.Token); + _ = tcs.TrySetCanceled(_clientLifetimeCts.Token); throw; } finally { - _pendingRequests.TryRemove(requestId, out _); + _ = _pendingRequests.TryRemove(requestId, out _); } } @@ -513,7 +512,7 @@ await SendMessageAsync( requestType, requestId ); - tcs.TrySetException(ex); + _ = tcs.TrySetException(ex); throw ex is ObsWebSocketException ? ex : new ObsWebSocketException($"Error in CallAsyncValue for '{requestType}'.", ex); @@ -525,12 +524,12 @@ await SendMessageAsync( requestType, requestId ); - tcs.TrySetCanceled(_clientLifetimeCts.Token); + _ = tcs.TrySetCanceled(_clientLifetimeCts.Token); throw; } finally { - _pendingRequests.TryRemove(requestId, out _); + _ = _pendingRequests.TryRemove(requestId, out _); } } @@ -640,7 +639,7 @@ await SendMessageAsync( "CallBatchAsync failed for batch {BatchRequestId}", batchRequestId ); - tcs.TrySetException(ex); + _ = tcs.TrySetException(ex); throw ex is ObsWebSocketException ? ex : new ObsWebSocketException($"Error in CallBatchAsync for '{batchRequestId}'.", ex); @@ -648,12 +647,12 @@ await SendMessageAsync( catch (OperationCanceledException) when (_clientLifetimeCts.IsCancellationRequested) { _logger.LogWarning("CallBatchAsync for {BatchRequestId} canceled.", batchRequestId); - tcs.TrySetCanceled(_clientLifetimeCts.Token); + _ = tcs.TrySetCanceled(_clientLifetimeCts.Token); throw; } finally { - _pendingBatchRequests.TryRemove(batchRequestId, out _); + _ = _pendingBatchRequests.TryRemove(batchRequestId, out _); } } @@ -797,7 +796,7 @@ CancellationToken externalCancellationToken $"Failed to connect after {attempt - 1} attempts.", _completionException ); - initialTcs.TrySetException(_completionException); // Fail the initial connect TCS + _ = initialTcs.TrySetException(_completionException); // Fail the initial connect TCS break; } @@ -840,7 +839,7 @@ await TryConnectAndIdentifyAsync(options, currentWebSocket, attempt, loopToken) _completionException = new TaskCanceledException( "Disconnect requested during connect." ); - initialTcs.TrySetCanceled(loopToken); // Signal cancellation + _ = initialTcs.TrySetCanceled(loopToken); // Signal cancellation break; } @@ -866,7 +865,7 @@ await TryConnectAndIdentifyAsync(options, currentWebSocket, attempt, loopToken) attempt ); _completionException = null; - initialTcs.TrySetResult(); // Signal successful initial connection + _ = initialTcs.TrySetResult(); // Signal successful initial connection attempt = 0; // Reset attempt count only on full success currentDelayMs = options.InitialReconnectDelayMs; @@ -884,7 +883,7 @@ await TryConnectAndIdentifyAsync(options, currentWebSocket, attempt, loopToken) attempt ); attemptException = ex; - initialTcs.TrySetCanceled(loopToken); // Signal cancellation + _ = initialTcs.TrySetCanceled(loopToken); // Signal cancellation break; } catch (AuthenticationFailureException authEx) @@ -896,7 +895,7 @@ await TryConnectAndIdentifyAsync(options, currentWebSocket, attempt, loopToken) ); attemptException = authEx; RaiseAuthenticationFailureEvent(options.ServerUri!, attempt, authEx); - initialTcs.TrySetException(authEx); // Signal auth failure + _ = initialTcs.TrySetException(authEx); // Signal auth failure break; // Auth failure is fatal } catch (ConnectionAttemptFailedException connEx) @@ -914,7 +913,7 @@ await TryConnectAndIdentifyAsync(options, currentWebSocket, attempt, loopToken) && (!options.AutoReconnectEnabled || options.MaxReconnectAttempts == 0) ) { - initialTcs.TrySetException(connEx); + _ = initialTcs.TrySetException(connEx); } } catch (WebSocketException wsEx) @@ -931,7 +930,7 @@ await TryConnectAndIdentifyAsync(options, currentWebSocket, attempt, loopToken) && (!options.AutoReconnectEnabled || options.MaxReconnectAttempts == 0) ) { - initialTcs.TrySetException( + _ = initialTcs.TrySetException( new ConnectionAttemptFailedException(wsEx.Message, wsEx) ); } @@ -950,7 +949,7 @@ await TryConnectAndIdentifyAsync(options, currentWebSocket, attempt, loopToken) && (!options.AutoReconnectEnabled || options.MaxReconnectAttempts == 0) ) { - initialTcs.TrySetException( + _ = initialTcs.TrySetException( new ConnectionAttemptFailedException(ex.Message, ex) ); } @@ -1000,13 +999,13 @@ await TryConnectAndIdentifyAsync(options, currentWebSocket, attempt, loopToken) { _logger.LogCritical(ex, "Catastrophic error in ConnectionLoopAsync."); _completionException = ex; - initialTcs.TrySetException(ex); // Ensure TCS is faulted + _ = initialTcs.TrySetException(ex); // Ensure TCS is faulted } finally { _logger.LogInformation("Exited connection loop. Finalizing state."); // If the loop exited without success/explicit failure setting the initial TCS, fail it now. - initialTcs.TrySetException( + _ = initialTcs.TrySetException( _completionException ?? new ObsWebSocketException( "Connection loop exited unexpectedly before initial connection completed." @@ -1181,8 +1180,8 @@ await SendMessageAsync( _webSocket = null; // Detach socket on failure // Ensure TCS are cleaned up on failure - _helloTcs?.TrySetException(ex); - _identifiedTcs?.TrySetException(ex); + _ = (_helloTcs?.TrySetException(ex)); + _ = (_identifiedTcs?.TrySetException(ex)); _helloTcs = null; // Clear fields after attempting to set exception _identifiedTcs = null; @@ -1405,9 +1404,9 @@ private void CleanupConnectionOnly(Exception reasonException) CancellationToken tokenForFailure = receiveLoopCts?.Token ?? _clientLifetimeCts?.Token ?? CancellationToken.None; - _helloTcs?.TrySetException(reasonException); + _ = (_helloTcs?.TrySetException(reasonException)); _helloTcs = null; - _identifiedTcs?.TrySetException(reasonException); + _ = (_identifiedTcs?.TrySetException(reasonException)); _identifiedTcs = null; FailPendingRequests(_pendingRequests, reasonException, tokenForFailure); @@ -1536,7 +1535,7 @@ private void ProcessIncomingMessage(object messageObject) case IncomingMessage jsonMsg: (opCode, payloadData) = (jsonMsg.Op, jsonMsg.D); break; - case IncomingMessage msgpackMsg: + case IncomingMessage> msgpackMsg: (opCode, payloadData) = (msgpackMsg.Op, msgpackMsg.D); break; default: @@ -1551,11 +1550,11 @@ private void ProcessIncomingMessage(object messageObject) { case WebSocketOpCode.Hello: _logger.LogTrace("Processing Hello message."); - _helloTcs?.TrySetResult(messageObject); + _ = (_helloTcs?.TrySetResult(messageObject)); break; case WebSocketOpCode.Identified: _logger.LogTrace("Processing Identified message."); - _identifiedTcs?.TrySetResult(messageObject); + _ = (_identifiedTcs?.TrySetResult(messageObject)); break; case WebSocketOpCode.Event: HandleEventMessage(payloadData); @@ -1603,7 +1602,7 @@ out TaskCompletionSource? tcs ) ) { - tcs.TrySetResult(response); + _ = tcs.TrySetResult(response); } else { @@ -1654,7 +1653,7 @@ out TaskCompletionSource? tcs ) ) { - tcs.TrySetResult(response); + _ = tcs.TrySetResult(response); } else { @@ -2179,7 +2178,7 @@ private TPayload ExtractPayloadFromHandshake(object messageObject, str object? rawPayload = messageObject switch { IncomingMessage jsonMsg => jsonMsg.D, - IncomingMessage msgpackMsg => msgpackMsg.D, + IncomingMessage> msgpackMsg => msgpackMsg.D, _ => throw new ObsWebSocketException( $"Unexpected message type during {messageName} handshake: {messageObject.GetType().Name}" ), @@ -2189,7 +2188,16 @@ private TPayload ExtractPayloadFromHandshake(object messageObject, str ?? throw new ObsWebSocketException($"Received null or invalid {messageName} payload."); } - private static JsonElement? SerializeRequestData(string _, object? requestData) + /// + /// Serializes request payload data into a for embedding in . + /// + /// Request context used for exception messages. + /// The request payload object. + /// + /// In Native AOT, arbitrary objects passed through the batch API path may fail if they are not registered + /// in . + /// + private static JsonElement? SerializeRequestData(string requestContext, object? requestData) { if (requestData is null) { @@ -2200,7 +2208,17 @@ private TPayload ExtractPayloadFromHandshake(object messageObject, str { return requestData is JsonElement element ? element - : JsonSerializer.SerializeToElement(requestData, s_payloadJsonOptions); + : JsonSerializer.SerializeToElement( + requestData, + s_payloadJsonOptions.GetTypeInfo(requestData.GetType()) + ); + } + catch (InvalidOperationException ex) + { + throw new ObsWebSocketException( + $"Failed to serialize request data for {requestContext}. In Native AOT builds, request data must be null, JsonElement, or a generated *RequestData record registered in ObsWebSocketJsonContext.", + ex + ); } catch (Exception ex) { @@ -2419,17 +2437,10 @@ CancellationToken ct ex.GetType().Name ); bool isCancellation = ex is OperationCanceledException; - foreach ((string _, TaskCompletionSource tcs) in requestsToFail) + foreach ((_, TaskCompletionSource tcs) in requestsToFail) { CancellationToken tokenToUse = isCancellation ? ct : CancellationToken.None; - if (isCancellation) - { - tcs.TrySetCanceled(tokenToUse); - } - else - { - tcs.TrySetException(ex); - } + _ = isCancellation ? tcs.TrySetCanceled(tokenToUse) : tcs.TrySetException(ex); } } diff --git a/ObsWebSocket.Core/ObsWebSocketServiceCollectionExtensions.cs b/ObsWebSocket.Core/ObsWebSocketServiceCollectionExtensions.cs index a791c8f..875e59b 100644 --- a/ObsWebSocket.Core/ObsWebSocketServiceCollectionExtensions.cs +++ b/ObsWebSocket.Core/ObsWebSocketServiceCollectionExtensions.cs @@ -28,19 +28,19 @@ public static IServiceCollection AddObsWebSocketClient( ArgumentNullException.ThrowIfNull(services); // Ensure Options infrastructure is registered - services.AddOptions(); + _ = services.AddOptions(); // Configure options if an action is provided if (configureOptions != null) { - services.Configure(configureOptions); + _ = services.Configure(configureOptions); } services.TryAddSingleton(); services.TryAddSingleton(); // This factory determines which concrete serializer to use based on options. - services.AddSingleton(sp => + _ = services.AddSingleton(sp => { ObsWebSocketClientOptions options = sp.GetRequiredService< IOptions diff --git a/ObsWebSocket.Core/Protocol/Common/FilterSettings/CommonFilterSettings.cs b/ObsWebSocket.Core/Protocol/Common/FilterSettings/CommonFilterSettings.cs index e319be4..65019e6 100644 --- a/ObsWebSocket.Core/Protocol/Common/FilterSettings/CommonFilterSettings.cs +++ b/ObsWebSocket.Core/Protocol/Common/FilterSettings/CommonFilterSettings.cs @@ -62,7 +62,7 @@ public sealed record ColorCorrectionFilterSettings( [property: JsonPropertyName("saturation")] double? Saturation = null, // V1 Specific (or maybe shared, depends on exact OBS version behavior) [property: JsonPropertyName("color")] long? Color = null, // Integer representation (e.g., white 16777215) - // V2 Specific + // V2 Specific [property: JsonPropertyName("color_add")] long? ColorAdd = null, [property: JsonPropertyName("color_multiply")] long? ColorMultiply = null ); diff --git a/ObsWebSocket.Core/Protocol/Common/StubTypes.cs b/ObsWebSocket.Core/Protocol/Common/StubTypes.cs index df830de..6ff8adf 100644 --- a/ObsWebSocket.Core/Protocol/Common/StubTypes.cs +++ b/ObsWebSocket.Core/Protocol/Common/StubTypes.cs @@ -1,5 +1,6 @@ -using System.Text.Json; +using System.Text.Json; using System.Text.Json.Serialization; +using MessagePack; namespace ObsWebSocket.Core.Protocol.Common; @@ -7,581 +8,484 @@ namespace ObsWebSocket.Core.Protocol.Common; /// Represents a common structure for scene data, often used in lists. Resilient to missing fields. /// /// Generated from heuristics based on obs-websocket protocol. -public sealed record SceneStub +[MessagePackObject] +public sealed class SceneStub { /// Scene name. [JsonPropertyName("sceneName")] + [Key("sceneName")] public string? SceneName { get; init; } /// Scene UUID. [JsonPropertyName("sceneUuid")] + [Key("sceneUuid")] public string? SceneUuid { get; init; } /// Scene index position. [JsonPropertyName("sceneIndex")] + [Key("sceneIndex")] public double? SceneIndex { get; init; } /// Captures any extra fields not explicitly defined in the stub. + [IgnoreMember] [JsonExtensionData] - public Dictionary? ExtensionData { get; init; } + public Dictionary? ExtensionData { get; set; } /// Initializes a new instance for deserialization via . [JsonConstructor] public SceneStub() { } - - /// - /// Initializes a new instance with all properties specified. - /// - public SceneStub(string? sceneName, string? sceneUuid, double? sceneIndex) - { - SceneName = sceneName; - SceneUuid = sceneUuid; - SceneIndex = sceneIndex; - } } /// /// Represents a common structure for scene item transform data. Resilient to missing fields. /// /// Generated from heuristics based on obs-websocket protocol. -public sealed record SceneItemTransformStub +[MessagePackObject] +public sealed class SceneItemTransformStub { /// /// Position X value. /// [JsonPropertyName("positionX")] + [Key("positionX")] public double? PositionX { get; init; } /// /// Position X value. /// [JsonPropertyName("positionY")] + [Key("positionY")] public double? PositionY { get; init; } /// /// Rotation value. /// [JsonPropertyName("rotation")] + [Key("rotation")] public double? Rotation { get; init; } /// /// Scale X value. /// [JsonPropertyName("scaleX")] + [Key("scaleX")] public double? ScaleX { get; init; } /// /// Scale Y value. /// [JsonPropertyName("scaleY")] + [Key("scaleY")] public double? ScaleY { get; init; } /// /// Width value. /// [JsonPropertyName("width")] + [Key("width")] public double? Width { get; init; } /// /// Height value. /// [JsonPropertyName("height")] + [Key("height")] public double? Height { get; init; } /// /// Source width value. /// [JsonPropertyName("sourceWidth")] + [Key("sourceWidth")] public double? SourceWidth { get; init; } /// /// Source height value. /// [JsonPropertyName("sourceHeight")] + [Key("sourceHeight")] public double? SourceHeight { get; init; } /// /// Alignment value. /// [JsonPropertyName("alignment")] + [Key("alignment")] public double? Alignment { get; init; } /// /// Bounds type value. /// [JsonPropertyName("boundsType")] + [Key("boundsType")] public string? BoundsType { get; init; } /// /// Bounds alignment value. /// [JsonPropertyName("boundsAlignment")] + [Key("boundsAlignment")] public double? BoundsAlignment { get; init; } /// /// Bounds width value. /// [JsonPropertyName("boundsWidth")] + [Key("boundsWidth")] public double? BoundsWidth { get; init; } /// /// Bounds height value. /// [JsonPropertyName("boundsHeight")] + [Key("boundsHeight")] public double? BoundsHeight { get; init; } /// /// Crop left value. /// [JsonPropertyName("cropLeft")] + [Key("cropLeft")] public double? CropLeft { get; init; } /// /// Crop top value. /// [JsonPropertyName("cropTop")] + [Key("cropTop")] public double? CropTop { get; init; } /// /// Crop right value. /// [JsonPropertyName("cropRight")] + [Key("cropRight")] public double? CropRight { get; init; } /// /// Crop bottom value. /// [JsonPropertyName("cropBottom")] + [Key("cropBottom")] public double? CropBottom { get; init; } /// Captures any extra fields not explicitly defined in the stub. + [IgnoreMember] [JsonExtensionData] - public Dictionary? ExtensionData { get; init; } + public Dictionary? ExtensionData { get; set; } /// Initializes a new instance for deserialization via . [JsonConstructor] public SceneItemTransformStub() { } - - /// - /// Initializes a new instance with all properties specified. - /// - public SceneItemTransformStub( - double? positionX, - double? positionY, - double? rotation, - double? scaleX, - double? scaleY, - double? width, - double? height, - double? sourceWidth, - double? sourceHeight, - double? alignment, - string? boundsType, - double? boundsAlignment, - double? boundsWidth, - double? boundsHeight, - double? cropLeft, - double? cropTop, - double? cropRight, - double? cropBottom - ) - { - PositionX = positionX; - PositionY = positionY; - Rotation = rotation; - ScaleX = scaleX; - ScaleY = scaleY; - Width = width; - Height = height; - SourceWidth = sourceWidth; - SourceHeight = sourceHeight; - Alignment = alignment; - BoundsType = boundsType; - BoundsAlignment = boundsAlignment; - BoundsWidth = boundsWidth; - BoundsHeight = boundsHeight; - CropLeft = cropLeft; - CropTop = cropTop; - CropRight = cropRight; - CropBottom = cropBottom; - } } /// /// Represents a common structure for scene item data, often used in lists. Resilient to missing fields. /// /// Generated from heuristics based on obs-websocket protocol. -public sealed record SceneItemStub +[MessagePackObject] +public sealed class SceneItemStub { /// Scene item ID. [JsonPropertyName("sceneItemId")] + [Key("sceneItemId")] public double? SceneItemId { get; init; } /// Scene item index position. [JsonPropertyName("sceneItemIndex")] + [Key("sceneItemIndex")] public double? SceneItemIndex { get; init; } /// Name of the source associated with the scene item. [JsonPropertyName("sourceName")] + [Key("sourceName")] public string? SourceName { get; init; } /// UUID of the source associated with the scene item. [JsonPropertyName("sourceUuid")] + [Key("sourceUuid")] public string? SourceUuid { get; init; } /// Whether the scene item is enabled (visible). [JsonPropertyName("sceneItemEnabled")] + [Key("sceneItemEnabled")] public bool? SceneItemEnabled { get; init; } /// Whether the scene item is locked. [JsonPropertyName("sceneItemLocked")] + [Key("sceneItemLocked")] public bool? SceneItemLocked { get; init; } /// Whether the source is a group. [JsonPropertyName("isGroup")] + [Key("isGroup")] public bool? IsGroup { get; init; } /// Transform data for the scene item. [JsonPropertyName("sceneItemTransform")] + [Key("sceneItemTransform")] public SceneItemTransformStub? SceneItemTransform { get; init; } // Made nullable for safety /// Captures any extra fields not explicitly defined in the stub. + [IgnoreMember] [JsonExtensionData] - public Dictionary? ExtensionData { get; init; } + public Dictionary? ExtensionData { get; set; } /// Initializes a new instance for deserialization via . [JsonConstructor] public SceneItemStub() { } - - /// - /// Initializes a new instance with all properties specified. - /// - public SceneItemStub( - double? sceneItemId, - double? sceneItemIndex, - string? sourceName, - string? sourceUuid, - bool? sceneItemEnabled, - bool? sceneItemLocked, - SceneItemTransformStub? sceneItemTransform, - bool? isGroup = null - ) - { - SceneItemId = sceneItemId; - SceneItemIndex = sceneItemIndex; - SourceName = sourceName; - SourceUuid = sourceUuid; - SceneItemEnabled = sceneItemEnabled; - SceneItemLocked = sceneItemLocked; - SceneItemTransform = sceneItemTransform; - IsGroup = isGroup; - } } /// /// Represents a common structure for filter data, often used in lists. Resilient to missing fields. /// /// Generated from heuristics based on obs-websocket protocol. -public sealed record FilterStub +[MessagePackObject] +public sealed class FilterStub { /// Filter name. [JsonPropertyName("filterName")] + [Key("filterName")] public string? FilterName { get; init; } /// Filter kind. [JsonPropertyName("filterKind")] + [Key("filterKind")] public string? FilterKind { get; init; } /// Filter index position. [JsonPropertyName("filterIndex")] + [Key("filterIndex")] public double? FilterIndex { get; init; } /// Whether the filter is enabled. [JsonPropertyName("filterEnabled")] + [Key("filterEnabled")] public bool? FilterEnabled { get; init; } /// Filter settings object. [JsonPropertyName("filterSettings")] + [Key("filterSettings")] public JsonElement? FilterSettings { get; init; } /// Captures any extra fields not explicitly defined in the stub. + [IgnoreMember] [JsonExtensionData] - public Dictionary? ExtensionData { get; init; } + public Dictionary? ExtensionData { get; set; } /// Initializes a new instance for deserialization via . [JsonConstructor] public FilterStub() { } - - /// - /// Initializes a new instance with all properties specified. - /// - public FilterStub( - string? filterName, - string? filterKind, - double? filterIndex, - bool? filterEnabled, - JsonElement? filterSettings = null - ) - { - FilterName = filterName; - FilterKind = filterKind; - FilterIndex = filterIndex; - FilterEnabled = filterEnabled; - FilterSettings = filterSettings; - } } /// /// Represents a common structure for input data, often used in lists. Resilient to missing fields. /// /// Generated from heuristics based on obs-websocket protocol. -public sealed record InputStub +[MessagePackObject] +public sealed class InputStub { /// Input name. [JsonPropertyName("inputName")] + [Key("inputName")] public string? InputName { get; init; } /// Input UUID. [JsonPropertyName("inputUuid")] + [Key("inputUuid")] public string? InputUuid { get; init; } /// Input kind. [JsonPropertyName("inputKind")] + [Key("inputKind")] public string? InputKind { get; init; } /// Unversioned input kind. [JsonPropertyName("unversionedInputKind")] + [Key("unversionedInputKind")] public string? UnversionedInputKind { get; init; } /// Captures any extra fields not explicitly defined in the stub. + [IgnoreMember] [JsonExtensionData] - public Dictionary? ExtensionData { get; init; } + public Dictionary? ExtensionData { get; set; } /// Initializes a new instance for deserialization via . [JsonConstructor] public InputStub() { } - - /// - /// Initializes a new instance with all properties specified. - /// - public InputStub( - string? inputName, - string? inputUuid, - string? inputKind, - string? unversionedInputKind - ) - { - InputName = inputName; - InputUuid = inputUuid; - InputKind = inputKind; - UnversionedInputKind = unversionedInputKind; - } } /// /// Represents a common structure for transition data, often used in lists. Resilient to missing fields. /// /// Generated from heuristics based on obs-websocket protocol. -public sealed record TransitionStub +[MessagePackObject] +public sealed class TransitionStub { /// Transition name. [JsonPropertyName("transitionName")] + [Key("transitionName")] public string? TransitionName { get; init; } /// Transition UUID. [JsonPropertyName("transitionUuid")] + [Key("transitionUuid")] public string? TransitionUuid { get; init; } /// Transition kind. [JsonPropertyName("transitionKind")] + [Key("transitionKind")] public string? TransitionKind { get; init; } /// Whether the transition is configurable. [JsonPropertyName("transitionConfigurable")] + [Key("transitionConfigurable")] public bool? TransitionConfigurable { get; init; } /// Whether the transition duration is fixed. [JsonPropertyName("transitionFixed")] + [Key("transitionFixed")] public bool? TransitionFixed { get; init; } /// Captures any extra fields not explicitly defined in the stub. + [IgnoreMember] [JsonExtensionData] - public Dictionary? ExtensionData { get; init; } + public Dictionary? ExtensionData { get; set; } /// Initializes a new instance for deserialization via . [JsonConstructor] public TransitionStub() { } - - /// - /// Initializes a new instance with all properties specified. - /// - public TransitionStub( - string? transitionName, - string? transitionUuid, - string? transitionKind, - bool? transitionConfigurable, - bool? transitionFixed - ) - { - TransitionName = transitionName; - TransitionUuid = transitionUuid; - TransitionKind = transitionKind; - TransitionConfigurable = transitionConfigurable; - TransitionFixed = transitionFixed; - } } /// /// Represents a common structure for output data, often used in lists. Resilient to missing fields. /// /// Generated from heuristics based on obs-websocket protocol. -public sealed record OutputStub +[MessagePackObject] +public sealed class OutputStub { /// Output name. [JsonPropertyName("outputName")] + [Key("outputName")] public string? OutputName { get; init; } /// Output kind. [JsonPropertyName("outputKind")] + [Key("outputKind")] public string? OutputKind { get; init; } /// Whether the output is active. [JsonPropertyName("outputActive")] + [Key("outputActive")] public bool? OutputActive { get; init; } /// Output width. [JsonPropertyName("outputWidth")] + [Key("outputWidth")] public double? OutputWidth { get; init; } /// Output height. [JsonPropertyName("outputHeight")] + [Key("outputHeight")] public double? OutputHeight { get; init; } /// Output settings. [JsonPropertyName("outputSettings")] + [Key("outputSettings")] public JsonElement? OutputSettings { get; init; } /// Captures any extra fields not explicitly defined in the stub. + [IgnoreMember] [JsonExtensionData] - public Dictionary? ExtensionData { get; init; } + public Dictionary? ExtensionData { get; set; } /// Initializes a new instance for deserialization via . [JsonConstructor] public OutputStub() { } - - /// - /// Initializes a new instance with all properties specified. - /// - public OutputStub( - string? outputName, - string? outputKind, - bool? outputActive, - double? outputWidth, - double? outputHeight, - JsonElement? outputSettings = null - ) - { - OutputName = outputName; - OutputKind = outputKind; - OutputActive = outputActive; - OutputWidth = outputWidth; - OutputHeight = outputHeight; - OutputSettings = outputSettings; - } } /// /// Represents a common structure for monitor data, often used in lists. Resilient to missing fields. /// /// Generated from heuristics based on obs-websocket protocol. -public sealed record MonitorStub +[MessagePackObject] +public sealed class MonitorStub { /// Monitor name. [JsonPropertyName("monitorName")] + [Key("monitorName")] public string? MonitorName { get; init; } /// Monitor index. [JsonPropertyName("monitorIndex")] + [Key("monitorIndex")] public double? MonitorIndex { get; init; } /// Monitor width. [JsonPropertyName("monitorWidth")] + [Key("monitorWidth")] public double? MonitorWidth { get; init; } /// Monitor height. [JsonPropertyName("monitorHeight")] + [Key("monitorHeight")] public double? MonitorHeight { get; init; } /// Monitor position X. [JsonPropertyName("monitorPositionX")] + [Key("monitorPositionX")] public double? MonitorPositionX { get; init; } /// Monitor position Y. [JsonPropertyName("monitorPositionY")] + [Key("monitorPositionY")] public double? MonitorPositionY { get; init; } /// Captures any extra fields not explicitly defined in the stub. + [IgnoreMember] [JsonExtensionData] - public Dictionary? ExtensionData { get; init; } + public Dictionary? ExtensionData { get; set; } /// Initializes a new instance for deserialization via . [JsonConstructor] public MonitorStub() { } - - /// - /// Initializes a new instance with all properties specified. - /// - public MonitorStub( - string? monitorName, - double? monitorIndex, - double? monitorWidth, - double? monitorHeight, - double? monitorPositionX, - double? monitorPositionY - ) - { - MonitorName = monitorName; - MonitorIndex = monitorIndex; - MonitorWidth = monitorWidth; - MonitorHeight = monitorHeight; - MonitorPositionX = monitorPositionX; - MonitorPositionY = monitorPositionY; - } } /// /// Represents a common structure for input property list items. Resilient to missing fields. /// /// Generated from heuristics based on obs-websocket protocol. -public sealed record PropertyItemStub +[MessagePackObject] +public sealed class PropertyItemStub { /// Item name. [JsonPropertyName("itemName")] + [Key("itemName")] public string? ItemName { get; init; } /// Item value (can be any JSON type). [JsonPropertyName("itemValue")] + [Key("itemValue")] public JsonElement? ItemValue { get; init; } /// Whether the item is enabled. [JsonPropertyName("itemEnabled")] + [Key("itemEnabled")] public bool? ItemEnabled { get; init; } /// Captures any extra fields not explicitly defined in the stub. + [IgnoreMember] [JsonExtensionData] - public Dictionary? ExtensionData { get; init; } + public Dictionary? ExtensionData { get; set; } /// Initializes a new instance for deserialization via . [JsonConstructor] public PropertyItemStub() { } - - /// - /// Initializes a new instance with all properties specified. - /// - public PropertyItemStub(string? itemName, JsonElement? itemValue, bool? itemEnabled) - { - ItemName = itemName; - ItemValue = itemValue; - ItemEnabled = itemEnabled; - } } + + + + + + + diff --git a/ObsWebSocket.Core/Protocol/Messages.cs b/ObsWebSocket.Core/Protocol/Messages.cs index 6203d93..bcaeb6a 100644 --- a/ObsWebSocket.Core/Protocol/Messages.cs +++ b/ObsWebSocket.Core/Protocol/Messages.cs @@ -1,5 +1,6 @@ -using System.Text.Json; +using System.Text.Json; using System.Text.Json.Serialization; +using MessagePack; using ObsWebSocket.Core.Protocol.Generated; namespace ObsWebSocket.Core.Protocol; @@ -10,9 +11,10 @@ namespace ObsWebSocket.Core.Protocol; /// The type of the data payload. /// The operation code. /// The data payload. +[MessagePackObject(SuppressSourceGeneration = true)] public record OutgoingMessage( - [property: JsonPropertyName("op")] WebSocketOpCode Op, - [property: JsonPropertyName("d")] T D + [property: JsonPropertyName("op"), Key("op")] WebSocketOpCode Op, + [property: JsonPropertyName("d"), Key("d")] T D ); /// @@ -22,47 +24,61 @@ public record OutgoingMessage( /// The type representing the raw data payload 'd'. /// The operation code. /// The raw data payload. +[MessagePackObject(SuppressSourceGeneration = true)] public record IncomingMessage( - [property: JsonPropertyName("op")] WebSocketOpCode Op, - [property: JsonPropertyName("d")] TData D + [property: JsonPropertyName("op"), Key("op")] WebSocketOpCode Op, + [property: JsonPropertyName("d"), Key("d")] TData D ); // --- Handshake Payloads (Internal) --- +[MessagePackObject(AllowPrivate = true)] internal record HelloPayload( - [property: JsonPropertyName("obsWebSocketVersion")] string ObsWebSocketVersion, - [property: JsonPropertyName("rpcVersion")] int RpcVersion, - [property: JsonPropertyName("authentication")] AuthenticationData? Authentication + [property: JsonPropertyName("obsWebSocketVersion"), Key("obsWebSocketVersion")] + string ObsWebSocketVersion, + [property: JsonPropertyName("rpcVersion"), Key("rpcVersion")] int RpcVersion, + [property: JsonPropertyName("authentication"), Key("authentication")] + AuthenticationData? Authentication ); +[MessagePackObject(AllowPrivate = true)] internal record AuthenticationData( - [property: JsonPropertyName("challenge")] string Challenge, - [property: JsonPropertyName("salt")] string Salt + [property: JsonPropertyName("challenge"), Key("challenge")] string Challenge, + [property: JsonPropertyName("salt"), Key("salt")] string Salt ); +[MessagePackObject(AllowPrivate = true)] internal record IdentifyPayload( - [property: JsonPropertyName("rpcVersion")] int RpcVersion, - [property: JsonPropertyName("authentication")] string? Authentication = null, - [property: JsonPropertyName("eventSubscriptions")] uint EventSubscriptions = 0 + [property: JsonPropertyName("rpcVersion"), Key("rpcVersion")] int RpcVersion, + [property: JsonPropertyName("authentication"), Key("authentication")] + string? Authentication = null, + [property: JsonPropertyName("eventSubscriptions"), Key("eventSubscriptions")] + uint EventSubscriptions = 0 ); +[MessagePackObject(AllowPrivate = true)] internal record IdentifiedPayload( - [property: JsonPropertyName("negotiatedRpcVersion")] int NegotiatedRpcVersion + [property: JsonPropertyName("negotiatedRpcVersion"), Key("negotiatedRpcVersion")] + int NegotiatedRpcVersion ); +[MessagePackObject(AllowPrivate = true)] internal record ReidentifyPayload( [property: JsonPropertyName("eventSubscriptions"), + Key("eventSubscriptions"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault) ] uint? EventSubscriptions = null ); // --- Request/Response Payloads --- +[MessagePackObject(AllowPrivate = true)] internal record RequestPayload( - [property: JsonPropertyName("requestType")] string RequestType, - [property: JsonPropertyName("requestId")] string RequestId, + [property: JsonPropertyName("requestType"), Key("requestType")] string RequestType, + [property: JsonPropertyName("requestId"), Key("requestId")] string RequestId, [property: JsonPropertyName("requestData"), + Key("requestData"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault) ] JsonElement? RequestData = null // Still JsonElement for outgoing JSON prep @@ -77,12 +93,14 @@ internal record RequestPayload( /// The original request identifier string. /// The status of the request processing. /// The raw response data payload, or default if none. +[MessagePackObject(SuppressSourceGeneration = true)] public record RequestResponsePayload( - [property: JsonPropertyName("requestType")] string RequestType, - [property: JsonPropertyName("requestId")] string RequestId, - [property: JsonPropertyName("requestStatus")] RequestStatus RequestStatus, + [property: JsonPropertyName("requestType"), Key("requestType")] string RequestType, + [property: JsonPropertyName("requestId"), Key("requestId")] string RequestId, + [property: JsonPropertyName("requestStatus"), Key("requestStatus")] RequestStatus RequestStatus, [property: JsonPropertyName("responseData"), + Key("responseData"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault) ] TData? ResponseData = default @@ -94,11 +112,13 @@ public record RequestResponsePayload( /// Indicates whether the request succeeded. /// The OBS WebSocket status code ( enum). /// Optional comment provided by OBS for context, especially on failure. +[MessagePackObject] public record RequestStatus( - [property: JsonPropertyName("result")] bool Result, - [property: JsonPropertyName("code")] int Code, + [property: JsonPropertyName("result"), Key("result")] bool Result, + [property: JsonPropertyName("code"), Key("code")] int Code, [property: JsonPropertyName("comment"), + Key("comment"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault) ] string? Comment = null @@ -113,11 +133,13 @@ public record RequestStatus( /// The unique event type string. /// Bitmask indicating the subscription intents that triggered this event. /// The specific data associated with the event, or default if none. +[MessagePackObject(SuppressSourceGeneration = true)] public record EventPayloadBase( - [property: JsonPropertyName("eventType")] string EventType, - [property: JsonPropertyName("eventIntent")] int EventIntent, + [property: JsonPropertyName("eventType"), Key("eventType")] string EventType, + [property: JsonPropertyName("eventIntent"), Key("eventIntent")] int EventIntent, [property: JsonPropertyName("eventData"), + Key("eventData"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault) ] TData? EventData = default @@ -130,24 +152,32 @@ public record EventPayloadBase( /// /// The OBS WebSocket request type string (e.g., "GetVersion", "SetCurrentProgramScene"). Cannot be null or empty. /// Optional data payload for this specific request within the batch. The object provided should be serializable to the format expected by OBS for the . -public record BatchRequestItem(string RequestType, object? RequestData = null); +[MessagePackObject] +public record BatchRequestItem( + [property: Key("requestType")] string RequestType, + [property: Key("requestData")] object? RequestData = null +); +[MessagePackObject(AllowPrivate = true)] internal record RequestBatchPayload( - [property: JsonPropertyName("requestId")] string RequestId, + [property: JsonPropertyName("requestId"), Key("requestId")] string RequestId, [property: JsonPropertyName("haltOnFailure"), + Key("haltOnFailure"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault) ] bool? HaltOnFailure, [property: JsonPropertyName("executionType"), + Key("executionType"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault) ] RequestBatchExecutionType? ExecutionType, - [property: JsonPropertyName("requests")] List Requests + [property: JsonPropertyName("requests"), Key("requests")] List Requests ); +[MessagePackObject(AllowPrivate = true, SuppressSourceGeneration = true)] internal record RequestBatchResponsePayload( - [property: JsonPropertyName("requestId")] string RequestId, - [property: JsonPropertyName("results")] List> Results + [property: JsonPropertyName("requestId"), Key("requestId")] string RequestId, + [property: JsonPropertyName("results"), Key("results")] List> Results ); diff --git a/ObsWebSocket.Core/Serialization/JsonMessageSerializer.cs b/ObsWebSocket.Core/Serialization/JsonMessageSerializer.cs index 4172a3d..3079957 100644 --- a/ObsWebSocket.Core/Serialization/JsonMessageSerializer.cs +++ b/ObsWebSocket.Core/Serialization/JsonMessageSerializer.cs @@ -1,5 +1,6 @@ -using System.Text; +using System.Text; using System.Text.Json; +using System.Text.Json.Serialization.Metadata; using Microsoft.Extensions.Logging; using ObsWebSocket.Core.Protocol; @@ -13,25 +14,26 @@ public class JsonMessageSerializer(ILogger logger) : IWebSocketMessageSerializer { private readonly ILogger _logger = logger; - private static readonly JsonSerializerOptions s_jsonOptions = new(JsonSerializerDefaults.Web); + private static readonly JsonSerializerOptions s_options = ObsWebSocketJsonContext.Default.Options; /// public string ProtocolSubProtocol => "obswebsocket.json"; /// - public async Task SerializeAsync( + public Task SerializeAsync( OutgoingMessage message, CancellationToken cancellationToken = default ) { ArgumentNullException.ThrowIfNull(message); + cancellationToken.ThrowIfCancellationRequested(); using MemoryStream memoryStream = new(); try { - await JsonSerializer - .SerializeAsync(memoryStream, message, s_jsonOptions, cancellationToken) - .ConfigureAwait(false); - return memoryStream.ToArray(); + JsonTypeInfo> typeInfo = + (JsonTypeInfo>)s_options.GetTypeInfo(typeof(OutgoingMessage)); + JsonSerializer.Serialize(memoryStream, message, typeInfo); + return Task.FromResult(memoryStream.ToArray()); } catch (Exception ex) when (ex is JsonException or NotSupportedException) { @@ -60,12 +62,12 @@ await JsonSerializer try { // Deserialize into the generic IncomingMessage with JsonElement as the data type + JsonTypeInfo> typeInfo = + (JsonTypeInfo>)s_options.GetTypeInfo( + typeof(IncomingMessage) + ); IncomingMessage? message = await JsonSerializer - .DeserializeAsync>( - messageStream, - s_jsonOptions, - cancellationToken - ) + .DeserializeAsync(messageStream, typeInfo, cancellationToken) .ConfigureAwait(false); if (message is null) @@ -125,7 +127,78 @@ is not null try { - return jsonElement.Deserialize(s_jsonOptions); + if (typeof(TPayload) == typeof(EventPayloadBase)) + { + JsonTypeInfo> eventTypeInfo = + (JsonTypeInfo>)s_options.GetTypeInfo( + typeof(EventPayloadBase) + ); + EventPayloadBase? eventPayload = jsonElement.Deserialize(eventTypeInfo); + return eventPayload is null + ? default + : (TPayload) + (object) + new EventPayloadBase( + eventPayload.EventType, + eventPayload.EventIntent, + eventPayload.EventData + ); + } + + if (typeof(TPayload) == typeof(RequestResponsePayload)) + { + JsonTypeInfo> responseTypeInfo = + (JsonTypeInfo>)s_options.GetTypeInfo( + typeof(RequestResponsePayload) + ); + RequestResponsePayload? responsePayload = + jsonElement.Deserialize(responseTypeInfo); + return responsePayload is null + ? default + : (TPayload) + (object) + new RequestResponsePayload( + responsePayload.RequestType, + responsePayload.RequestId, + responsePayload.RequestStatus, + responsePayload.ResponseData + ); + } + + if (typeof(TPayload) == typeof(RequestBatchResponsePayload)) + { + JsonTypeInfo> batchTypeInfo = + (JsonTypeInfo>)s_options.GetTypeInfo( + typeof(RequestBatchResponsePayload) + ); + RequestBatchResponsePayload? batchPayload = + jsonElement.Deserialize(batchTypeInfo); + if (batchPayload is null) + { + return default; + } + + List> mappedResults = + [ + .. batchPayload.Results.Select(result => new RequestResponsePayload( + result.RequestType, + result.RequestId, + result.RequestStatus, + result.ResponseData + )), + ]; + + return (TPayload) + (object)new RequestBatchResponsePayload( + batchPayload.RequestId, + mappedResults + ); + } + + JsonTypeInfo typeInfo = (JsonTypeInfo)s_options.GetTypeInfo( + typeof(TPayload) + ); + return jsonElement.Deserialize(typeInfo); } catch (Exception ex) { @@ -168,7 +241,10 @@ is not null { // Deserialize will return default(TPayload) if JSON is null, which is valid for nullable structs, // but might be undesirable for non-nullable ones (though caught earlier if JSON is explicitly null). - return jsonElement.Deserialize(s_jsonOptions); + JsonTypeInfo typeInfo = (JsonTypeInfo)s_options.GetTypeInfo( + typeof(TPayload) + ); + return jsonElement.Deserialize(typeInfo); } catch (Exception ex) { diff --git a/ObsWebSocket.Core/Serialization/MsgPackJsonElementResolver.cs b/ObsWebSocket.Core/Serialization/MsgPackJsonElementResolver.cs new file mode 100644 index 0000000..c447972 --- /dev/null +++ b/ObsWebSocket.Core/Serialization/MsgPackJsonElementResolver.cs @@ -0,0 +1,111 @@ +using System.Buffers; +using System.Text.Json; +using MessagePack; +using MessagePack.Formatters; + +namespace ObsWebSocket.Core.Serialization; + +internal sealed class MsgPackJsonElementResolver : IFormatterResolver +{ + public static readonly IFormatterResolver Instance = new MsgPackJsonElementResolver(); + + private MsgPackJsonElementResolver() { } + + public IMessagePackFormatter? GetFormatter() + { + if (typeof(T) == typeof(JsonElement)) + { + return (IMessagePackFormatter)(object)JsonElementFormatter.Instance; + } + + return typeof(T) == typeof(JsonElement?) + ? (IMessagePackFormatter)(object)NullableJsonElementFormatter.Instance + : null; + } + + internal sealed class JsonElementFormatter : IMessagePackFormatter + { + public static readonly JsonElementFormatter Instance = new(); + + public void Serialize( + ref MessagePackWriter writer, + JsonElement value, + MessagePackSerializerOptions options + ) + { + if (value.ValueKind is JsonValueKind.Null or JsonValueKind.Undefined) + { + writer.WriteNil(); + return; + } + + byte[] raw = MessagePackSerializer.ConvertFromJson(value.GetRawText()); + writer.WriteRaw(raw); + } + + public JsonElement Deserialize( + ref MessagePackReader reader, + MessagePackSerializerOptions options + ) + { + if (reader.TryReadNil()) + { + return default; + } + + options.Security.DepthStep(ref reader); + byte[] raw = ReadRawValue(ref reader); + string json = MessagePackSerializer.ConvertToJson(raw); + using JsonDocument document = JsonDocument.Parse(json); + JsonElement result = document.RootElement.Clone(); + reader.Depth--; + return result; + } + + private static byte[] ReadRawValue(ref MessagePackReader reader) + { + SequencePosition start = reader.Position; + MessagePackReader clone = reader; + clone.Skip(); + SequencePosition end = clone.Position; + ReadOnlySequence sequence = reader.Sequence.Slice(start, end); + byte[] raw = new byte[checked((int)sequence.Length)]; + sequence.CopyTo(raw); + reader = clone; + return raw; + } + } + + internal sealed class NullableJsonElementFormatter : IMessagePackFormatter + { + public static readonly NullableJsonElementFormatter Instance = new(); + + public void Serialize( + ref MessagePackWriter writer, + JsonElement? value, + MessagePackSerializerOptions options + ) + { + if (!value.HasValue || value.Value.ValueKind is JsonValueKind.Null or JsonValueKind.Undefined) + { + writer.WriteNil(); + return; + } + + JsonElementFormatter.Instance.Serialize(ref writer, value.Value, options); + } + + public JsonElement? Deserialize( + ref MessagePackReader reader, + MessagePackSerializerOptions options + ) + { + if (reader.TryReadNil()) + { + return null; + } + + return JsonElementFormatter.Instance.Deserialize(ref reader, options); + } + } +} diff --git a/ObsWebSocket.Core/Serialization/MsgPackMessageSerializer.cs b/ObsWebSocket.Core/Serialization/MsgPackMessageSerializer.cs index a3ce4d4..2f521b8 100644 --- a/ObsWebSocket.Core/Serialization/MsgPackMessageSerializer.cs +++ b/ObsWebSocket.Core/Serialization/MsgPackMessageSerializer.cs @@ -1,7 +1,9 @@ -using MessagePack; +using System.Buffers; +using MessagePack; using MessagePack.Resolvers; using Microsoft.Extensions.Logging; using ObsWebSocket.Core.Protocol; +using ObsWebSocket.Core.Protocol.Generated; namespace ObsWebSocket.Core.Serialization; @@ -14,14 +16,10 @@ public class MsgPackMessageSerializer(ILogger logger) { private readonly ILogger _logger = logger; - // Configure MessagePack options. - // ContractlessStandardResolverAllowPrivate: Allows deserialization without explicit attributes and works with record primary constructors. private static readonly MessagePackSerializerOptions s_msgPackOptions = - ContractlessStandardResolverAllowPrivate.Options; - - // Optional: Consider adding compression if needed and supported by OBS (check compatibility) - // private static readonly MessagePackSerializerOptions s_msgPackOptions = ContractlessStandardResolverAllowPrivate.Options - // .WithCompression(MessagePackCompression.Lz4BlockArray); + MessagePackSerializerOptions + .Standard.WithResolver(CompositeResolver.Create(CreateResolverChain())) + .WithSecurity(MessagePackSecurity.UntrustedData); /// public string ProtocolSubProtocol => "obswebsocket.msgpack"; @@ -37,11 +35,7 @@ public Task SerializeAsync( try { - byte[] serializedData = MessagePackSerializer.Serialize( - message, - s_msgPackOptions, - cancellationToken - ); + byte[] serializedData = SerializeOutgoingEnvelope(message, cancellationToken); return Task.FromResult(serializedData); } catch (MessagePackSerializationException ex) @@ -84,21 +78,13 @@ public Task SerializeAsync( try { - // Deserialize using 'object' as the placeholder type for the payload 'd'. - // With ContractlessStandardResolver, this typically results in nested Dictionary, List, or primitive types. - IncomingMessage? message = await MessagePackSerializer - .DeserializeAsync>( - messageStream, - s_msgPackOptions, - cancellationToken - ) - .ConfigureAwait(false); - - if (message is null) - { - _logger.LogWarning("MessagePack deserialization resulted in null."); - } - else if (_logger.IsEnabled(LogLevel.Trace)) + await using MemoryStream buffer = new(); + await messageStream.CopyToAsync(buffer, cancellationToken).ConfigureAwait(false); + IncomingMessage> message = DeserializeIncomingEnvelope( + buffer.ToArray() + ); + + if (_logger.IsEnabled(LogLevel.Trace)) { _logger.LogTrace("Deserialized MessagePack message: Op={Op}", message.Op); } @@ -107,9 +93,7 @@ public Task SerializeAsync( } catch (MessagePackSerializationException ex) { - // Difficult to log problematic MessagePack data directly compared to JSON. _logger.LogError(ex, "MessagePack deserialization failed."); - // Consider reading stream to byte array here for logging if absolutely needed, but can be large. return null; } catch (Exception ex) @@ -123,21 +107,27 @@ public Task SerializeAsync( public TPayload? DeserializePayload(object? rawPayloadData) where TPayload : class { - if (rawPayloadData is null) + if (rawPayloadData is not ReadOnlyMemory raw) { return default; } try { - // ContractlessStandardResolver should handle converting from the underlying object/dictionary - // structure back to the target TPayload type if the structure is compatible or TPayload - // uses attributes recognized by the resolver (like [Key]). - // If direct conversion fails, serializing then deserializing is a fallback. - return MessagePackSerializer.Deserialize( - MessagePackSerializer.Serialize(rawPayloadData, s_msgPackOptions), - s_msgPackOptions - ); + if (typeof(TPayload) == typeof(EventPayloadBase)) + { + return (TPayload)(object)DeserializeEventPayloadBase(raw); + } + + if (typeof(TPayload) == typeof(RequestResponsePayload)) + { + MessagePackReader wrapperReader = new(raw); + return (TPayload)(object)DeserializeRequestResponsePayload(ref wrapperReader); + } + + return typeof(TPayload) == typeof(RequestBatchResponsePayload) + ? (TPayload)(object)DeserializeRequestBatchResponsePayload(raw) + : MessagePackSerializer.Deserialize(raw, s_msgPackOptions); } catch (Exception ex) { @@ -155,18 +145,14 @@ public Task SerializeAsync( public TPayload? DeserializeValuePayload(object? rawPayloadData) where TPayload : struct { - if (rawPayloadData is null) + if (rawPayloadData is not ReadOnlyMemory raw) { return default; } try { - // Similar logic as above for value types - return MessagePackSerializer.Deserialize( - MessagePackSerializer.Serialize(rawPayloadData, s_msgPackOptions), - s_msgPackOptions - ); + return MessagePackSerializer.Deserialize(raw, s_msgPackOptions); } catch (Exception ex) { @@ -179,4 +165,266 @@ public Task SerializeAsync( return default; } } + + private static IncomingMessage> DeserializeIncomingEnvelope( + ReadOnlyMemory payload + ) + { + MessagePackReader reader = new(payload); + int count = reader.ReadMapHeader(); + WebSocketOpCode op = default; + ReadOnlyMemory data = default; + + for (int i = 0; i < count; i++) + { + string? key = reader.ReadString(); + if (key == "op") + { + op = (WebSocketOpCode)reader.ReadInt32(); + continue; + } + + if (key == "d") + { + data = ReadRawValue(ref reader); + continue; + } + + reader.Skip(); + } + + return new IncomingMessage>(op, data); + } + + private static byte[] SerializeOutgoingEnvelope( + OutgoingMessage message, + CancellationToken cancellationToken + ) + { + ArrayBufferWriter buffer = new(); + MessagePackWriter writer = new(buffer); + + writer.WriteMapHeader(2); + writer.Write("op"); + writer.Write((int)message.Op); + writer.Write("d"); + + if (message.D is RequestBatchPayload batchPayload) + { + SerializeRequestBatchPayload(ref writer, batchPayload, cancellationToken); + writer.Flush(); + return [.. buffer.WrittenSpan]; + } + + byte[] payloadBytes = MessagePackSerializer.Serialize(message.D, s_msgPackOptions, cancellationToken); + writer.WriteRaw(payloadBytes); + writer.Flush(); + + return [.. buffer.WrittenSpan]; + } + + private static ReadOnlyMemory ReadRawValue(ref MessagePackReader reader) + { + MessagePackReader clone = reader; + clone.Skip(); + ReadOnlySequence sequence = reader.Sequence.Slice(reader.Position, clone.Position); + byte[] raw = new byte[checked((int)sequence.Length)]; + sequence.CopyTo(raw); + reader = clone; + return raw; + } + + private static EventPayloadBase DeserializeEventPayloadBase(ReadOnlyMemory raw) + { + MessagePackReader reader = new(raw); + int count = reader.ReadMapHeader(); + + string? eventType = null; + int eventIntent = 0; + object? eventData = null; + + for (int i = 0; i < count; i++) + { + string? key = reader.ReadString(); + switch (key) + { + case "eventType": + eventType = reader.ReadString(); + break; + case "eventIntent": + eventIntent = reader.ReadInt32(); + break; + case "eventData": + eventData = ReadRawValue(ref reader); + break; + default: + reader.Skip(); + break; + } + } + + return new EventPayloadBase(eventType ?? string.Empty, eventIntent, eventData); + } + + private static IFormatterResolver[] CreateResolverChain() + { + return + [ + MsgPackJsonElementResolver.Instance, + MsgPackStubExtensionDataResolver.Instance, + ObsWebSocketMsgPackResolver.Instance, + BuiltinResolver.Instance, + SourceGeneratedFormatterResolver.Instance, + PrimitiveObjectResolver.Instance, + ]; + } + + private static RequestBatchResponsePayload DeserializeRequestBatchResponsePayload( + ReadOnlyMemory raw + ) + { + MessagePackReader reader = new(raw); + int count = reader.ReadMapHeader(); + + string? requestId = null; + List> results = []; + + for (int i = 0; i < count; i++) + { + string? key = reader.ReadString(); + switch (key) + { + case "requestId": + requestId = reader.ReadString(); + break; + case "results": + { + int resultCount = reader.ReadArrayHeader(); + for (int r = 0; r < resultCount; r++) + { + results.Add(DeserializeRequestResponsePayload(ref reader)); + } + + break; + } + default: + reader.Skip(); + break; + } + } + + return new RequestBatchResponsePayload(requestId ?? string.Empty, results); + } + + private static void SerializeRequestBatchPayload( + ref MessagePackWriter writer, + RequestBatchPayload payload, + CancellationToken cancellationToken + ) + { + writer.WriteMapHeader(4); + writer.Write("requestId"); + writer.Write(payload.RequestId); + writer.Write("haltOnFailure"); + if (payload.HaltOnFailure.HasValue) + { + writer.Write(payload.HaltOnFailure.Value); + } + else + { + writer.WriteNil(); + } + + writer.Write("executionType"); + if (payload.ExecutionType.HasValue) + { + writer.Write((int)payload.ExecutionType.Value); + } + else + { + writer.WriteNil(); + } + + writer.Write("requests"); + writer.WriteArrayHeader(payload.Requests.Count); + foreach (RequestPayload request in payload.Requests) + { + SerializeRequestPayload(ref writer, request, cancellationToken); + } + } + + private static void SerializeRequestPayload( + ref MessagePackWriter writer, + RequestPayload request, + CancellationToken cancellationToken + ) + { + writer.WriteMapHeader(3); + writer.Write("requestType"); + writer.Write(request.RequestType); + writer.Write("requestId"); + writer.Write(request.RequestId); + writer.Write("requestData"); + if (request.RequestData.HasValue) + { + byte[] raw = MessagePackSerializer.Serialize( + request.RequestData.Value, + s_msgPackOptions, + cancellationToken + ); + writer.WriteRaw(raw); + } + else + { + writer.WriteNil(); + } + } + + private static RequestResponsePayload DeserializeRequestResponsePayload( + ref MessagePackReader reader + ) + { + int count = reader.ReadMapHeader(); + + string? requestType = null; + string? requestId = null; + Protocol.RequestStatus requestStatus = new(false, 0, "Missing requestStatus"); + object? responseData = null; + + for (int i = 0; i < count; i++) + { + string? key = reader.ReadString(); + switch (key) + { + case "requestType": + requestType = reader.ReadString(); + break; + case "requestId": + requestId = reader.ReadString(); + break; + case "requestStatus": + { + ReadOnlyMemory statusRaw = ReadRawValue(ref reader); + requestStatus = MessagePackSerializer.Deserialize( + statusRaw, + s_msgPackOptions + ); + break; + } + case "responseData": + responseData = ReadRawValue(ref reader); + break; + default: + reader.Skip(); + break; + } + } + + return new RequestResponsePayload( + requestType ?? string.Empty, + requestId ?? string.Empty, + requestStatus, + responseData + ); + } } diff --git a/ObsWebSocket.Core/Serialization/MsgPackStubExtensionDataResolver.cs b/ObsWebSocket.Core/Serialization/MsgPackStubExtensionDataResolver.cs new file mode 100644 index 0000000..0602f1a --- /dev/null +++ b/ObsWebSocket.Core/Serialization/MsgPackStubExtensionDataResolver.cs @@ -0,0 +1,153 @@ +using System.Buffers; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization.Metadata; +using MessagePack; +using MessagePack.Formatters; +using ObsWebSocket.Core.Protocol.Common; + +namespace ObsWebSocket.Core.Serialization; + +internal sealed class MsgPackStubExtensionDataResolver : IFormatterResolver +{ + public static readonly IFormatterResolver Instance = new MsgPackStubExtensionDataResolver(); + + private MsgPackStubExtensionDataResolver() { } + + public IMessagePackFormatter? GetFormatter() + { + Type type = typeof(T); + if (type == typeof(SceneStub)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter(); + } + + if (type == typeof(SceneItemTransformStub)) + { + return (IMessagePackFormatter)(object) + new MsgPackJsonBridgeFormatter(); + } + + if (type == typeof(SceneItemStub)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter(); + } + + if (type == typeof(FilterStub)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter(); + } + + if (type == typeof(InputStub)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter(); + } + + if (type == typeof(TransitionStub)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter(); + } + + if (type == typeof(List)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter>(); + } + + if (type == typeof(List)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter>(); + } + + if (type == typeof(List)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter>(); + } + + if (type == typeof(List)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter>(); + } + + if (type == typeof(List)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter>(); + } + + if (type == typeof(List)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter>(); + } + + if (type == typeof(List)) + { + return (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter>(); + } + + if (type == typeof(List)) + { + return (IMessagePackFormatter)(object) + new MsgPackJsonBridgeFormatter>(); + } + + return type == typeof(OutputStub) + ? (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter() + : type == typeof(MonitorStub) + ? (IMessagePackFormatter)(object)new MsgPackJsonBridgeFormatter() + : type == typeof(PropertyItemStub) + ? (IMessagePackFormatter)(object) + new MsgPackJsonBridgeFormatter() + : null; + } + + private sealed class MsgPackJsonBridgeFormatter : IMessagePackFormatter + where T : class + { + public void Serialize(ref MessagePackWriter writer, T? value, MessagePackSerializerOptions options) + { + if (value is null) + { + writer.WriteNil(); + return; + } + + JsonTypeInfo typeInfo = (JsonTypeInfo) + ObsWebSocketJsonContext.Default.Options.GetTypeInfo(typeof(T)); + string json = JsonSerializer.Serialize(value, typeInfo); + byte[] raw = MessagePackSerializer.ConvertFromJson(json); + writer.WriteRaw(raw); + } + + public T? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.TryReadNil()) + { + return null; + } + + options.Security.DepthStep(ref reader); + + byte[] raw = ReadRawValue(ref reader); + string json = MessagePackSerializer.ConvertToJson(raw); + + JsonTypeInfo typeInfo = (JsonTypeInfo) + ObsWebSocketJsonContext.Default.Options.GetTypeInfo(typeof(T)); + T? result = JsonSerializer.Deserialize(json, typeInfo); + + reader.Depth--; + return result; + } + + private static byte[] ReadRawValue(ref MessagePackReader reader) + { + SequencePosition start = reader.Position; + MessagePackReader clone = reader; + clone.Skip(); + SequencePosition end = clone.Position; + ReadOnlySequence sequence = reader.Sequence.Slice(start, end); + byte[] raw = new byte[checked((int)sequence.Length)]; + sequence.CopyTo(raw); + reader = clone; + return raw; + } + } +} diff --git a/ObsWebSocket.Example/ExampleStartupCommandOptions.cs b/ObsWebSocket.Example/ExampleStartupCommandOptions.cs new file mode 100644 index 0000000..cdb9baa --- /dev/null +++ b/ObsWebSocket.Example/ExampleStartupCommandOptions.cs @@ -0,0 +1,8 @@ +namespace ObsWebSocket.Example; + +public sealed class ExampleStartupCommandOptions +{ + public string? Command { get; init; } + + public string[] Arguments { get; init; } = []; +} diff --git a/ObsWebSocket.Example/ExampleValidationOptions.cs b/ObsWebSocket.Example/ExampleValidationOptions.cs new file mode 100644 index 0000000..b350934 --- /dev/null +++ b/ObsWebSocket.Example/ExampleValidationOptions.cs @@ -0,0 +1,8 @@ +namespace ObsWebSocket.Example; + +public sealed class ExampleValidationOptions +{ + public bool RunValidationOnStartup { get; set; } + + public int ValidationIterations { get; set; } = 1; +} diff --git a/ObsWebSocket.Example/ObsWebSocket.Example.csproj b/ObsWebSocket.Example/ObsWebSocket.Example.csproj index 3e5ca71..de9692e 100644 --- a/ObsWebSocket.Example/ObsWebSocket.Example.csproj +++ b/ObsWebSocket.Example/ObsWebSocket.Example.csproj @@ -1,9 +1,12 @@  Exe - net9.0 + net10.0 enable enable + true + true + true @@ -14,7 +17,8 @@ - - + + + diff --git a/ObsWebSocket.Example/Program.cs b/ObsWebSocket.Example/Program.cs index a755f39..ed3b01a 100644 --- a/ObsWebSocket.Example/Program.cs +++ b/ObsWebSocket.Example/Program.cs @@ -4,11 +4,20 @@ using Microsoft.Extensions.Logging; using ObsWebSocket.Core; using ObsWebSocket.Example; +using Spectre.Console; HostApplicationBuilder builder = Host.CreateApplicationBuilder(args); +AnsiConsole.Write( + new Rule("[cyan]ObsWebSocket Example Tool[/]") + { + Justification = Justify.Left, + } +); // Reads appsettings.json, environment variables, command-line args -builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); +builder + .Configuration.SetBasePath(AppContext.BaseDirectory) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); builder.Logging.ClearProviders(); builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging")); @@ -16,6 +25,16 @@ // Configure OBS WebSocket Client options from "Obs" section in appsettings.json builder.Services.Configure(builder.Configuration.GetSection("Obs")); +builder.Services.Configure( + builder.Configuration.GetSection("ExampleValidation") +); +builder.Services.AddSingleton( + new ExampleStartupCommandOptions + { + Command = args.Length > 0 ? args[0] : null, + Arguments = args.Length > 1 ? args[1..] : [], + } +); // Add the ObsWebSocketClient and its dependencies builder.Services.AddObsWebSocketClient(); @@ -27,4 +46,4 @@ await host.RunAsync(); -Console.WriteLine("\nExample application finished."); +AnsiConsole.MarkupLine("[grey]Example application finished.[/]"); diff --git a/ObsWebSocket.Example/Worker.cs b/ObsWebSocket.Example/Worker.cs index f5ce17c..dc4602c 100644 --- a/ObsWebSocket.Example/Worker.cs +++ b/ObsWebSocket.Example/Worker.cs @@ -1,15 +1,18 @@ -using System.Text.Json; -using System.Text.Json.Serialization; +using System.Buffers; +using System.Text.Json; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using ObsWebSocket.Core; using ObsWebSocket.Core.Events; using ObsWebSocket.Core.Events.Generated; +using ObsWebSocket.Core.Networking; using ObsWebSocket.Core.Protocol; using ObsWebSocket.Core.Protocol.Generated; using ObsWebSocket.Core.Protocol.Requests; using ObsWebSocket.Core.Protocol.Responses; +using ObsWebSocket.Core.Serialization; +using Spectre.Console; namespace ObsWebSocket.Example; @@ -17,19 +20,22 @@ internal sealed partial class Worker( ILogger logger, ObsWebSocketClient obsClient, IOptions obsOptions, + IOptions validationOptions, + ExampleStartupCommandOptions startupCommandOptions, + ILoggerFactory loggerFactory, + IWebSocketConnectionFactory connectionFactory, IHostApplicationLifetime lifetime ) : BackgroundService { private readonly ILogger _logger = logger; private readonly ObsWebSocketClient _obsClient = obsClient; + private readonly ObsWebSocketClientOptions _baseOptions = obsOptions.Value; + private readonly ExampleValidationOptions _validationOptions = validationOptions.Value; + private readonly ExampleStartupCommandOptions _startupCommandOptions = startupCommandOptions; + private readonly ILoggerFactory _loggerFactory = loggerFactory; + private readonly IWebSocketConnectionFactory _connectionFactory = connectionFactory; private readonly IHostApplicationLifetime _lifetime = lifetime; - private static readonly JsonSerializerOptions s_serializerOptions = new() - { - WriteIndented = true, - DefaultIgnoreCondition = JsonIgnoreCondition.Never, - }; - // Store the *intended* subscription flags (initialized from options, updated by set-subs) // Note: The client doesn't currently expose the *actual* negotiated flags from the server. private uint _currentSubscriptionFlags = @@ -61,12 +67,58 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) try { + if (_validationOptions.RunValidationOnStartup) + { + _logger.LogInformation("Running startup transport validation suite..."); + await RunTransportValidationSuiteAsync(stoppingToken).ConfigureAwait(false); + } + + if ( + string.Equals( + _startupCommandOptions.Command, + "run-transport-tests", + StringComparison.OrdinalIgnoreCase + ) + ) + { + string startupCommand = _startupCommandOptions.Command!; + _logger.LogInformation( + "Running startup command: {Command}", + startupCommand + ); + await ProcessCommandAsync( + startupCommand, + _startupCommandOptions.Arguments, + stoppingToken + ) + .ConfigureAwait(false); + _lifetime.StopApplication(); + return; + } + // --- Connect to OBS --- // ConnectAsync now uses the IOptions internally await _obsClient.ConnectAsync(stoppingToken); if (_obsClient.IsConnected) { + if (!string.IsNullOrWhiteSpace(_startupCommandOptions.Command)) + { + string startupCommand = _startupCommandOptions.Command!; + _logger.LogInformation( + "Running startup command: {Command}", + startupCommand + ); + await ProcessCommandAsync( + startupCommand, + _startupCommandOptions.Arguments, + stoppingToken + ) + .ConfigureAwait(false); + _lifetime.StopApplication(); + return; + } + await RunCommandLoopAsync(stoppingToken); } else @@ -118,10 +170,11 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) private async Task RunCommandLoopAsync(CancellationToken stoppingToken) { _logger.LogInformation("Command loop started. Type 'help' for commands, 'exit' to quit."); + RenderCommandHelp(); while (!stoppingToken.IsCancellationRequested && _obsClient.IsConnected) { - Console.Write("> "); + AnsiConsole.Markup("[grey]> [/] "); string? commandLine = await Console.In.ReadLineAsync(stoppingToken); if (string.IsNullOrWhiteSpace(commandLine)) { @@ -186,25 +239,7 @@ CancellationToken cancellationToken switch (command) { case "help": - Console.WriteLine( - """ - Available commands: - help - Show this help - exit - Exit the application - status - Show connection status - version - Get OBS & WebSocket version info - scene - Get current program scene - mute [input name] - Toggle mute for the specified audio input - unmute [input name] - (Alias for mute) - get-input-settings [scene name] [input name] - Get settings for an input - set-text [scene] [input] [text...] - Set text for a Text (GDI+) source - list-filters [source name] - List filters for a source (input/scene) - toggle-filter [source] [filter] - Toggle enable state of a filter - batch-example - Run a sample batch request sequence - list-subs - Show current event subscription flags (intended) - set-subs - Change event subscriptions via Reidentify - """ - ); + RenderCommandHelp(); return false; case "exit": @@ -213,7 +248,10 @@ CancellationToken cancellationToken return true; case "status": - Console.WriteLine($"Client Connected: {_obsClient.IsConnected}"); + RenderKeyValueTable( + "Connection Status", + [("Client Connected", _obsClient.IsConnected ? "Yes" : "No")] + ); return false; case "version": @@ -222,22 +260,30 @@ CancellationToken cancellationToken ); if (version is not null) { - Console.WriteLine($"OBS Version: {version.ObsVersion}"); - Console.WriteLine($"WebSocket Version: {version.ObsWebSocketVersion}"); - Console.WriteLine($"RPC Version: {version.RpcVersion}"); - Console.WriteLine( - $"Platform: {version.Platform} ({version.PlatformDescription})" - ); - Console.WriteLine( - $"Supported Image Formats: {string.Join(", ", version.SupportedImageFormats ?? [])}" + RenderKeyValueTable( + "Version Info", + [ + ("OBS Version", version.ObsVersion ?? "N/A"), + ("WebSocket Version", version.ObsWebSocketVersion ?? "N/A"), + ("RPC Version", version.RpcVersion.ToString()), + ( + "Platform", + $"{version.Platform ?? "N/A"} ({version.PlatformDescription ?? "N/A"})" + ), + ( + "Supported Image Formats", + string.Join(", ", version.SupportedImageFormats ?? []) + ), + ( + "Available Requests", + (version.AvailableRequests?.Count ?? 0).ToString() + ), + ] ); - Console.WriteLine( - $"Available Requests ({version.AvailableRequests?.Count ?? 0})" - ); // Only show count } else { - Console.WriteLine("Could not get version info."); + UiWarn("Could not get version info."); } return false; @@ -247,10 +293,15 @@ CancellationToken cancellationToken await _obsClient.GetCurrentProgramSceneAsync( cancellationToken: cancellationToken ); - Console.WriteLine( - scene is not null - ? $"Current Program Scene: {scene.SceneName ?? "N/A"} (UUID: {scene.SceneUuid ?? "N/A"})" - : "Could not get current scene." + if (scene is null) + { + UiWarn("Could not get current scene."); + return false; + } + + RenderKeyValueTable( + "Current Scene", + [("Name", scene.SceneName ?? "N/A"), ("UUID", scene.SceneUuid ?? "N/A")] ); return false; @@ -258,7 +309,7 @@ scene is not null case "unmute": if (args.Length == 0) { - Console.WriteLine($"Usage: {command} [input name]"); + UiWarn($"Usage: {command} [input name]"); return false; } @@ -268,10 +319,14 @@ scene is not null new ToggleInputMuteRequestData(inputNameToMute), cancellationToken: cancellationToken ); - Console.WriteLine( - muteState is not null - ? $"Input '{inputNameToMute}' is now {(muteState.InputMuted ? "MUTED" : "UNMUTED")}" - : $"Could not toggle mute state for {inputNameToMute}. Does it exist?" + if (muteState is null) + { + UiWarn($"Could not toggle mute state for {inputNameToMute}. Does it exist?"); + return false; + } + + UiSuccess( + $"Input '{inputNameToMute}' is now {(muteState.InputMuted ? "MUTED" : "UNMUTED")}" ); return false; @@ -279,7 +334,7 @@ muteState is not null case "get-input-settings": if (args.Length < 2) { - Console.WriteLine("Usage: get-input-settings [scene name] [input name]"); + UiWarn("Usage: get-input-settings [scene name] [input name]"); return false; } @@ -300,17 +355,16 @@ muteState is not null cancellationToken: cancellationToken ); - if (settings?.InputSettings is not null) + if (settings?.InputSettings is JsonElement inputSettingsElement) { - Console.WriteLine($"--- Settings for '{inputForGetSettings}' ---"); - Console.WriteLine($"Kind: {settings.InputKind ?? "Unknown"}"); // Kind comes from response - Console.WriteLine( - JsonSerializer.Serialize(settings.InputSettings, s_serializerOptions) + UiInfo( + $"Settings for '{inputForGetSettings}' (kind: {settings.InputKind ?? "Unknown"})" ); + RenderJsonPanel("Input Settings", inputSettingsElement.GetRawText()); } else { - Console.WriteLine( + UiWarn( $"Could not get settings for input '{inputForGetSettings}'. It might not exist or have no specific settings." ); } @@ -325,7 +379,7 @@ muteState is not null case "set-text": if (args.Length < 3) { - Console.WriteLine( + UiWarn( "Usage: set-text [scene name] [text source name] [new text...]" ); return false; @@ -352,9 +406,19 @@ muteState is not null // Construct the settings object for Text (GDI+) source // IMPORTANT: The exact property name ('text') depends on the input kind. // Assume 'text' for 'text_gdiplus_v3'. Inspect with 'get-input-settings' if unsure. - JsonElement newSettings = JsonSerializer.SerializeToElement( - new { text = newText } + ArrayBufferWriter textPayloadBuffer = new(); + using (Utf8JsonWriter writer = new(textPayloadBuffer)) + { + writer.WriteStartObject(); + writer.WriteString("text", newText); + writer.WriteEndObject(); + writer.Flush(); + } + + using JsonDocument textPayloadDocument = JsonDocument.Parse( + textPayloadBuffer.WrittenMemory ); + JsonElement newSettings = textPayloadDocument.RootElement.Clone(); // Send the request await _obsClient.SetInputSettingsAsync( @@ -366,7 +430,7 @@ await _obsClient.SetInputSettingsAsync( cancellationToken: cancellationToken ); - Console.WriteLine( + UiSuccess( $"Successfully set text for '{inputForSetText}' to: '{newText}'" ); } @@ -390,7 +454,7 @@ await _obsClient.SetInputSettingsAsync( case "list-filters": if (args.Length == 0) { - Console.WriteLine("Usage: list-filters [source name]"); + UiWarn("Usage: list-filters [source name]"); return false; } @@ -402,17 +466,29 @@ await _obsClient.GetSourceFilterListAsync( ); if (filterList?.Filters is not null && filterList.Filters.Count > 0) { - Console.WriteLine($"--- Filters for '{sourceForFilters}' ---"); + Table table = new() { Title = new TableTitle($"Filters for '{sourceForFilters}'") }; + _ = table.AddColumn("Index"); + _ = table.AddColumn("Name"); + _ = table.AddColumn("Kind"); + _ = table.AddColumn("Enabled"); foreach (Core.Protocol.Common.FilterStub filterElement in filterList.Filters) { - Console.WriteLine( - $" - [{filterElement.FilterIndex}] {filterElement.FilterName} ({filterElement.FilterKind}) - Enabled: {filterElement.FilterEnabled}" + string filterIndex = filterElement.FilterIndex?.ToString() ?? "N/A"; + string filterName = Markup.Escape(filterElement.FilterName ?? "N/A") ?? "N/A"; + string filterKind = Markup.Escape(filterElement.FilterKind ?? "N/A") ?? "N/A"; + _ = table.AddRow( + filterIndex, + filterName, + filterKind, + filterElement.FilterEnabled == true ? "[green]Yes[/]" : "[grey]No[/]" ); } + + AnsiConsole.Write(table); } else { - Console.WriteLine($"No filters found for source '{sourceForFilters}'."); + UiInfo($"No filters found for source '{sourceForFilters}'."); } return false; @@ -420,7 +496,7 @@ await _obsClient.GetSourceFilterListAsync( case "toggle-filter": if (args.Length < 2) { - Console.WriteLine("Usage: toggle-filter [source name] [filter name]"); + UiWarn("Usage: toggle-filter [source name] [filter name]"); return false; } @@ -440,7 +516,7 @@ await _obsClient.GetSourceFilterAsync( if (currentFilterState is null) { - Console.WriteLine( + UiWarn( $"Could not find filter '{filterToToggle}' on source '{sourceForToggle}'." ); return false; @@ -458,27 +534,41 @@ await _obsClient.SetSourceFilterEnabledAsync( cancellationToken: cancellationToken ); - Console.WriteLine( + UiSuccess( $"Filter '{filterToToggle}' on '{sourceForToggle}' toggled to {(newState ? "ENABLED" : "DISABLED")}" ); return false; case "batch-example": + { _logger.LogInformation("Running batch example..."); + ArrayBufferWriter batchSettingsBuffer = new(); + using (Utf8JsonWriter batchSettingsWriter = new(batchSettingsBuffer)) + { + batchSettingsWriter.WriteStartObject(); + batchSettingsWriter.WriteString("text", "Batch updated!"); + batchSettingsWriter.WriteEndObject(); + batchSettingsWriter.Flush(); + } + + using JsonDocument batchSettingsDocument = JsonDocument.Parse( + batchSettingsBuffer.WrittenMemory + ); + JsonElement batchSettingsPayload = batchSettingsDocument.RootElement.Clone(); + List batchItems = [ new("GetVersion", null), new("GetCurrentProgramScene", null), - new("GetInputList", new { inputKind = "text_gdiplus_v3" }), // Get only text inputs - new("Sleep", new { sleepMillis = 100 }), // Wait 100ms + new("GetInputList", new GetInputListRequestData("text_gdiplus_v3")), + new("Sleep", new SleepRequestData(sleepMillis: 100)), new( "SetInputSettings", // Example: Set specific text source's text (requires knowing name) - new - { - inputName = "MyTextSource", // REPLACE WITH YOUR ACTUAL TEXT SOURCE NAME - inputSettings = new { text = "Batch updated!" }, - overlay = true, - } + new SetInputSettingsRequestData( + batchSettingsPayload, + inputName: "MyTextSource", // REPLACE WITH YOUR ACTUAL TEXT SOURCE NAME + overlay: true + ) ), ]; @@ -489,55 +579,81 @@ await _obsClient.SetSourceFilterEnabledAsync( cancellationToken: cancellationToken ); - Console.WriteLine($"--- Batch Results ({batchResults.Count} items) ---"); + Table batchTable = new() { Title = new TableTitle($"Batch Results ({batchResults.Count} items)") }; + _ = batchTable.AddColumn("Request"); + _ = batchTable.AddColumn("Status"); + _ = batchTable.AddColumn("Code"); + _ = batchTable.AddColumn("Details"); foreach (RequestResponsePayload result in batchResults) { - Console.WriteLine( - $" [{result.RequestType} / {result.RequestId[(result.RequestId.LastIndexOf('_') + 1)..]}]: {(result.RequestStatus.Result ? "Success" : "Failed")} (Code: {result.RequestStatus.Code})" - ); + string shortId = result.RequestId[(result.RequestId.LastIndexOf('_') + 1)..]; + string status = result.RequestStatus.Result ? "[green]Success[/]" : "[red]Failed[/]"; + string details = string.Empty; if (!result.RequestStatus.Result) { - Console.WriteLine($" Error: {result.RequestStatus.Comment ?? "N/A"}"); + details = $"Error: {Markup.Escape(result.RequestStatus.Comment ?? "N/A")}"; } else if (result.ResponseData is not null) { - // Attempt to pretty print response data string responseJson = "Could not serialize response data"; try { - responseJson = JsonSerializer.Serialize( - result.ResponseData, - s_serializerOptions - ); + responseJson = + result.ResponseData is JsonElement jsonElement + ? jsonElement.GetRawText() + : result.ResponseData.ToString() ?? string.Empty; } catch { /* Ignore serialization errors for logging */ } - Console.WriteLine($" Response:\n{responseJson}\n"); + details = + responseJson.Length > 140 + ? $"{Markup.Escape(responseJson[..140])}..." + : Markup.Escape(responseJson); } + + _ = batchTable.AddRow( + $"{Markup.Escape(result.RequestType ?? "N/A")} / {Markup.Escape(shortId)}", + status, + result.RequestStatus.Code.ToString(), + details + ); } + AnsiConsole.Write(batchTable); _logger.LogInformation("Batch example finished."); return false; + } + + case "run-transport-tests": + await RunTransportValidationSuiteAsync(cancellationToken).ConfigureAwait(false); + return false; case "list-subs": - Console.WriteLine( - $"Current Intended Event Subscriptions: {_currentSubscriptionFlags} ({(EventSubscription)_currentSubscriptionFlags})" - ); - Console.WriteLine( - "Note: This reflects the last requested flags, not necessarily the flags acknowledged by the server." + RenderKeyValueTable( + "Event Subscriptions", + [ + ( + "Current Intended Flags", + $"{_currentSubscriptionFlags} ({(EventSubscription)_currentSubscriptionFlags})" + ), + ( + "Note", + "Reflects last requested flags, not server-acknowledged state." + ), + ] ); return false; case "set-subs": if (args.Length == 0 || !uint.TryParse(args[0], out uint newFlags)) { - Console.WriteLine("Usage: set-subs "); - Console.WriteLine( + UiWarn("Usage: set-subs "); + UiInfo( "Example: set-subs 65 (General | Scenes | Inputs, 1 | 4 | 8 = 13)" ); - Console.WriteLine( + UiInfo( "See ObsWebSocket.Core.Protocol.Generated.EventSubscription for flags." ); return false; @@ -549,11 +665,11 @@ await _obsClient.SetSourceFilterEnabledAsync( (EventSubscription)newFlags ); await _obsClient.ReidentifyAsync( - (uint)newFlags, + newFlags, cancellationToken: cancellationToken ); _currentSubscriptionFlags = newFlags; // Update our stored value *after* successful re-identify - Console.WriteLine( + UiSuccess( $"Re-identified successfully. Intended subscriptions set to: {_currentSubscriptionFlags} ({(EventSubscription)_currentSubscriptionFlags})" ); return false; @@ -564,11 +680,474 @@ await _obsClient.ReidentifyAsync( // --- End of New Commands --- default: - Console.WriteLine($"Unknown command: '{command}'. Type 'help'."); + UiWarn($"Unknown command: '{command}'. Type 'help'."); + return false; + } + } + + private async Task RunTransportValidationSuiteAsync(CancellationToken cancellationToken) + { + int iterations = Math.Max(1, _validationOptions.ValidationIterations); + Rule rule = new("[cyan]Transport Validation[/]") + { + Justification = Justify.Left + }; + AnsiConsole.Write(rule); + for (int i = 0; i < iterations; i++) + { + _logger.LogInformation( + "Running transport validation iteration {Current}/{Total} (JSON then MsgPack)...", + i + 1, + iterations + ); + UiInfo($"Iteration {i + 1}/{iterations}: JSON then MsgPack"); + await RunTransportValidationCycleAsync(SerializationFormat.Json, cancellationToken) + .ConfigureAwait(false); + await RunTransportValidationCycleAsync(SerializationFormat.MsgPack, cancellationToken) + .ConfigureAwait(false); + } + } + + private async Task RunTransportValidationCycleAsync( + SerializationFormat format, + CancellationToken cancellationToken + ) + { + ObsWebSocketClientOptions cycleOptions = CloneOptionsForFormat(format); + IWebSocketMessageSerializer serializer = CreateSerializer(format); + + await using ObsWebSocketClient cycleClient = new( + _loggerFactory.CreateLogger(), + serializer, + Options.Create(cycleOptions), + _connectionFactory + ); + + await cycleClient.ConnectAsync(cancellationToken).ConfigureAwait(false); + try + { + GetVersionResponseData? version = await cycleClient + .GetVersionAsync(cancellationToken: cancellationToken) + .ConfigureAwait(false); + if ( + version is null + || string.IsNullOrWhiteSpace(version.ObsVersion) + || string.IsNullOrWhiteSpace(version.ObsWebSocketVersion) + || version.RpcVersion <= 0 + ) + { + throw new InvalidOperationException( + $"[{format}] Invalid GetVersion response. ObsVersion='{version?.ObsVersion}', ObsWebSocketVersion='{version?.ObsWebSocketVersion}', RpcVersion={version?.RpcVersion}." + ); + } + + GetVersionResponseData validatedVersion = version; + + _logger.LogInformation( + "[{Format}] Connected to OBS {ObsVersion} (RPC {RpcVersion})", + format, + validatedVersion.ObsVersion, + validatedVersion.RpcVersion + ); + + GetSceneListResponseData? scenes = await cycleClient + .GetSceneListAsync(cancellationToken) + .ConfigureAwait(false); + if (scenes?.Scenes is null || scenes.Scenes.Count == 0) + { + throw new InvalidOperationException( + $"[{format}] GetSceneList returned no scenes." + ); + } + + _logger.LogInformation( + "[{Format}] Scene stubs deserialized: {SceneCount}", + format, + scenes?.Scenes?.Count ?? 0 + ); + int sceneCount = scenes?.Scenes?.Count ?? 0; + + GetInputListResponseData? inputs = await cycleClient + .GetInputListAsync(new GetInputListRequestData(), cancellationToken) + .ConfigureAwait(false); + if (inputs?.Inputs is null || inputs.Inputs.Count == 0) + { + throw new InvalidOperationException( + $"[{format}] GetInputList returned no inputs." + ); + } + + _logger.LogInformation( + "[{Format}] Input stubs deserialized: {InputCount}", + format, + inputs?.Inputs?.Count ?? 0 + ); + int inputCount = inputs?.Inputs?.Count ?? 0; + + int filterCount = 0; + string? inputName = inputs?.Inputs?.FirstOrDefault()?.InputName; + if (!string.IsNullOrWhiteSpace(inputName)) + { + GetSourceFilterListResponseData? filters = await cycleClient + .GetSourceFilterListAsync( + new GetSourceFilterListRequestData(inputName), + cancellationToken + ) + .ConfigureAwait(false); + _logger.LogInformation( + "[{Format}] Filter stubs deserialized for '{InputName}': {FilterCount}", + format, + inputName, + filters?.Filters?.Count ?? 0 + ); + filterCount = filters?.Filters?.Count ?? 0; + } + + GetSourceFilterKindListResponseData? filterKinds = await cycleClient + .GetSourceFilterKindListAsync(cancellationToken) + .ConfigureAwait(false); + if (filterKinds?.SourceFilterKinds is null || filterKinds.SourceFilterKinds.Count == 0) + { + throw new InvalidOperationException( + $"[{format}] GetSourceFilterKindList returned no filter kinds." + ); + } + + _logger.LogInformation( + "[{Format}] Filter kind entries: {KindCount}", + format, + filterKinds?.SourceFilterKinds?.Count ?? 0 + ); + int filterKindCount = filterKinds?.SourceFilterKinds?.Count ?? 0; + + ( + bool extensionDataObserved, + bool extensionDataValid, + int extensionBagCount, + int extensionEntryCount + ) = ValidateStubExtensionData(scenes, inputs, inputName, format); + + if (extensionDataObserved && !extensionDataValid) + { + throw new InvalidOperationException( + $"[{format}] Stub ExtensionData validation failed." + ); + } + + string testId = $"{format}-custom-{Guid.NewGuid():N}"; + JsonElement customPayload = JsonDocument + .Parse( + $$""" + { + "testId": "{{testId}}", + "format": "{{format}}", + "nested": { + "enabled": true, + "levels": [1, 2, 3] + } + } + """ + ) + .RootElement.Clone(); + + Task waitForCustomEvent = cycleClient.WaitForEventAsync< + CustomEventEventArgs + >( + predicate: _ => true, + timeout: TimeSpan.FromSeconds(2), + cancellationToken: cancellationToken + ); + + await cycleClient + .BroadcastCustomEventAsync( + new BroadcastCustomEventRequestData(customPayload), + cancellationToken + ) + .ConfigureAwait(false); + + CustomEventEventArgs? customEvent = await waitForCustomEvent.ConfigureAwait(false); + bool customEventVerified = false; + if ( + customEvent?.EventData.EventData is JsonElement receivedCustomData + && TryFindCustomEventPayloadByTestId( + receivedCustomData, + testId, + out JsonElement actualCustomData + ) + && actualCustomData.GetProperty("testId").GetString() == testId + && actualCustomData.GetProperty("nested").GetProperty("enabled").GetBoolean() + && actualCustomData.GetProperty("nested").GetProperty("levels").GetArrayLength() == 3 + ) + { + customEventVerified = true; + _logger.LogInformation( + "[{Format}] CustomEvent roundtrip verified with testId {TestId}.", + format, + testId + ); + } + else + { + _logger.LogWarning( + "[{Format}] CustomEvent payload verification skipped (event received: {Received}).", + format, + customEvent is not null + ); + } + + List> batch = await cycleClient + .CallBatchAsync( + [new("GetVersion", null), new("GetSceneList", null)], + executionType: RequestBatchExecutionType.SerialRealtime, + haltOnFailure: false, + cancellationToken: cancellationToken + ) + .ConfigureAwait(false); + if (batch.Count != 2 || batch.Any(result => !result.RequestStatus.Result)) + { + throw new InvalidOperationException( + $"[{format}] Batch validation failed. Count={batch.Count}." + ); + } + + _logger.LogInformation("[{Format}] Batch call results: {ResultCount}", format, batch.Count); + + Table summary = new() { Title = new TableTitle($"{format} Validation Summary") }; + _ = summary.AddColumn("Check"); + _ = summary.AddColumn("Result"); + _ = summary.AddRow("OBS Version", Markup.Escape(validatedVersion.ObsVersion ?? "N/A")); + _ = summary.AddRow("RPC", validatedVersion.RpcVersion.ToString()); + _ = summary.AddRow("Scenes", sceneCount.ToString()); + _ = summary.AddRow("Inputs", inputCount.ToString()); + _ = summary.AddRow("Filters (first input)", filterCount.ToString()); + _ = summary.AddRow("Filter Kinds", filterKindCount.ToString()); + _ = summary.AddRow( + "Stub ExtensionData", + extensionDataObserved + ? $"[green]Pass[/] ({extensionBagCount} bag(s), {extensionEntryCount} entries)" + : "[yellow]Unverified[/]" + ); + _ = summary.AddRow("CustomEvent", customEventVerified ? "[green]Pass[/]" : "[yellow]Unverified[/]"); + _ = summary.AddRow("Batch", $"{batch.Count} result(s)"); + AnsiConsole.Write(summary); + } + finally + { + if (cycleClient.IsConnected) + { + await cycleClient.DisconnectAsync(cancellationToken: CancellationToken.None) + .ConfigureAwait(false); + } + } + } + + private IWebSocketMessageSerializer CreateSerializer(SerializationFormat format) => + format switch + { + SerializationFormat.MsgPack => new MsgPackMessageSerializer( + _loggerFactory.CreateLogger() + ), + _ => new JsonMessageSerializer(_loggerFactory.CreateLogger()), + }; + + private ( + bool Observed, + bool Valid, + int ExtensionBagCount, + int ExtensionEntryCount + ) ValidateStubExtensionData( + GetSceneListResponseData? scenes, + GetInputListResponseData? inputs, + string? firstInputName, + SerializationFormat format + ) + { + List?> extensionBags = + [ + ..(scenes?.Scenes ?? []).Select(scene => scene.ExtensionData), + ..(inputs?.Inputs ?? []).Select(input => input.ExtensionData), + ]; + + int extensionBagCount = extensionBags.Count(bag => bag is { Count: > 0 }); + int extensionEntryCount = extensionBags + .Where(bag => bag is { Count: > 0 }) + .Sum(bag => bag!.Count); + + bool valid = true; + foreach (Dictionary? bag in extensionBags.Where(bag => bag is { Count: > 0 })) + { + foreach ((string _, JsonElement value) in bag!) + { + if (!IsValidExtensionDataValue(value)) + { + valid = false; + break; + } + } + + if (!valid) + { + break; + } + } + + bool observed = extensionBagCount > 0; + if (observed) + { + _logger.LogInformation( + "[{Format}] Stub ExtensionData validated: {BagCount} bag(s), {EntryCount} entries.", + format, + extensionBagCount, + extensionEntryCount + ); + } + else + { + _logger.LogWarning( + "[{Format}] Stub ExtensionData was not present in GetSceneList/GetInputList responses for input '{InputName}'.", + format, + firstInputName ?? "N/A" + ); + } + + return (observed, valid, extensionBagCount, extensionEntryCount); + } + + private static bool IsValidExtensionDataValue(JsonElement value) + { + try + { + if (value.ValueKind == JsonValueKind.Undefined) + { + return false; + } + + _ = value.GetRawText(); + return true; + } + catch (Exception) + { + return false; + } + } + + private static bool TryFindCustomEventPayloadByTestId( + JsonElement source, + string testId, + out JsonElement payload + ) => TryFindCustomEventPayloadByTestIdCore(source, testId, depth: 0, out payload); + + private static bool TryFindCustomEventPayloadByTestIdCore( + JsonElement source, + string testId, + int depth, + out JsonElement payload + ) + { + payload = default; + if (depth > 8) + { + return false; + } + + switch (source.ValueKind) + { + case JsonValueKind.Object: + { + if ( + source.TryGetProperty("testId", out JsonElement idProperty) + && idProperty.ValueKind == JsonValueKind.String + && string.Equals(idProperty.GetString(), testId, StringComparison.Ordinal) + ) + { + payload = source.Clone(); + return true; + } + + foreach (JsonProperty property in source.EnumerateObject()) + { + if ( + TryFindCustomEventPayloadByTestIdCore( + property.Value, + testId, + depth + 1, + out payload + ) + ) + { + return true; + } + } + + return false; + } + + case JsonValueKind.Array: + { + foreach (JsonElement element in source.EnumerateArray()) + { + if ( + TryFindCustomEventPayloadByTestIdCore(element, testId, depth + 1, out payload) + ) + { + return true; + } + } + + return false; + } + + case JsonValueKind.String: + { + string? rawString = source.GetString(); + if (string.IsNullOrWhiteSpace(rawString)) + { + return false; + } + + string trimmed = rawString.Trim(); + if (!trimmed.StartsWith('{') && !trimmed.StartsWith('[')) + { + return false; + } + + try + { + using JsonDocument parsed = JsonDocument.Parse(trimmed); + return TryFindCustomEventPayloadByTestIdCore( + parsed.RootElement, + testId, + depth + 1, + out payload + ); + } + catch (JsonException) + { + return false; + } + } + + default: return false; } } + private ObsWebSocketClientOptions CloneOptionsForFormat(SerializationFormat format) => + new() + { + ServerUri = _baseOptions.ServerUri, + Password = _baseOptions.Password, + EventSubscriptions = _baseOptions.EventSubscriptions, + HandshakeTimeoutMs = _baseOptions.HandshakeTimeoutMs, + RequestTimeoutMs = _baseOptions.RequestTimeoutMs, + Format = format, + AutoReconnectEnabled = false, + InitialReconnectDelayMs = _baseOptions.InitialReconnectDelayMs, + MaxReconnectAttempts = _baseOptions.MaxReconnectAttempts, + ReconnectBackoffMultiplier = _baseOptions.ReconnectBackoffMultiplier, + MaxReconnectDelayMs = _baseOptions.MaxReconnectDelayMs, + }; + // --- Helper to find Scene Item ID --- private async Task GetSceneItemIdAsync( string sceneName, @@ -683,24 +1262,143 @@ await _obsClient.GetSourceFilterDefaultSettingsAsync( // 3. Output the results as JSON _logger.LogInformation("Default settings retrieval complete. Outputting JSON..."); - Console.WriteLine("\n--- FILTER DEFAULT SETTINGS START ---"); + Rule settingsStartRule = new("[yellow]Filter Default Settings[/]") + { + Justification = Justify.Left + }; + AnsiConsole.Write(settingsStartRule); try { - string jsonOutput = JsonSerializer.Serialize(filterDefaultSettings); - Console.WriteLine(jsonOutput); + ArrayBufferWriter outputBuffer = new(); + using (Utf8JsonWriter writer = new(outputBuffer, new JsonWriterOptions { Indented = true })) + { + writer.WriteStartObject(); + foreach ((string filterKind, JsonElement? value) in filterDefaultSettings) + { + writer.WritePropertyName(filterKind); + if (value is JsonElement element) + { + element.WriteTo(writer); + } + else + { + writer.WriteNullValue(); + } + } + + writer.WriteEndObject(); + writer.Flush(); + } + + string jsonOutput = System.Text.Encoding.UTF8.GetString(outputBuffer.WrittenSpan); + RenderJsonPanel("Filter Kind Defaults", jsonOutput); } catch (Exception ex) { _logger.LogError(ex, "Failed to serialize filter default settings results to JSON."); - Console.WriteLine("{\"error\": \"Failed to serialize results.\"}"); + UiError("{\"error\": \"Failed to serialize results.\"}"); } - Console.WriteLine("--- FILTER DEFAULT SETTINGS END ---\n"); - _logger.LogInformation("Default filter settings retrieval finished."); // No cleanup needed as we didn't add filters to the source } + private static void RenderCommandHelp() + { + Table commandTable = new() { Title = new TableTitle("Available Commands") }; + _ = commandTable.AddColumn("Command"); + _ = commandTable.AddColumn("Description"); + _ = commandTable.AddRow(Markup.Escape("help"), Markup.Escape("Show this help")); + _ = commandTable.AddRow(Markup.Escape("exit"), Markup.Escape("Exit the application")); + _ = commandTable.AddRow(Markup.Escape("status"), Markup.Escape("Show connection status")); + _ = commandTable.AddRow( + Markup.Escape("version"), + Markup.Escape("Get OBS and WebSocket version info") + ); + _ = commandTable.AddRow( + Markup.Escape("scene"), + Markup.Escape("Get current program scene") + ); + _ = commandTable.AddRow( + Markup.Escape("mute [input name]"), + Markup.Escape("Toggle mute for audio input") + ); + _ = commandTable.AddRow(Markup.Escape("unmute [input name]"), Markup.Escape("Alias for mute")); + _ = commandTable.AddRow( + Markup.Escape("get-input-settings [scene] [input]"), + Markup.Escape("Get settings for an input") + ); + _ = commandTable.AddRow( + Markup.Escape("set-text [scene] [input] [text...]"), + Markup.Escape("Set text on text source") + ); + _ = commandTable.AddRow( + Markup.Escape("list-filters [source]"), + Markup.Escape("List filters for source") + ); + _ = commandTable.AddRow( + Markup.Escape("toggle-filter [source] [filter]"), + Markup.Escape("Toggle filter enabled state") + ); + _ = commandTable.AddRow( + Markup.Escape("batch-example"), + Markup.Escape("Run sample batch request sequence") + ); + _ = commandTable.AddRow( + Markup.Escape("run-transport-tests"), + Markup.Escape("Run JSON + MsgPack validation cycles") + ); + _ = commandTable.AddRow( + Markup.Escape("list-subs"), + Markup.Escape("Show intended event subscription flags") + ); + _ = commandTable.AddRow( + Markup.Escape("set-subs "), + Markup.Escape("Reidentify with new event flags") + ); + _ = commandTable.AddRow( + Markup.Escape("get-all-filter-settings"), + Markup.Escape("Dump default settings for all filter kinds") + ); + AnsiConsole.Write(commandTable); + } + + private static void RenderKeyValueTable(string title, IReadOnlyList<(string Key, string Value)> rows) + { + Table table = new() { Title = new TableTitle(title) }; + _ = table.AddColumn("Property"); + _ = table.AddColumn("Value"); + foreach ((string key, string value) in rows) + { + _ = table.AddRow(Markup.Escape(key), Markup.Escape(value)); + } + + AnsiConsole.Write(table); + } + + private static void RenderJsonPanel(string title, string json) + { + Panel panel = new(new Markup(Markup.Escape(json))) + { + Header = new PanelHeader(title), + Border = BoxBorder.Rounded, + Expand = true, + }; + AnsiConsole.Write(panel); + } + + private static void UiInfo(string message) => + AnsiConsole.MarkupLine($"[grey]{Markup.Escape(message)}[/]"); + + private static void UiWarn(string message) => + AnsiConsole.MarkupLine($"[yellow]{Markup.Escape(message)}[/]"); + + private static void UiSuccess(string message) => + AnsiConsole.MarkupLine($"[green]{Markup.Escape(message)}[/]"); + + private static void UiError(string message) => + AnsiConsole.MarkupLine($"[red]{Markup.Escape(message)}[/]"); + // --- Event Handlers --- private void OnObsConnecting(object? sender, ConnectingEventArgs e) => _logger.LogInformation( @@ -794,3 +1492,5 @@ private sealed class SceneItemNotFoundException(string message) : Exception(mess [System.Text.RegularExpressions.GeneratedRegex(@"code (\d+):")] private static partial System.Text.RegularExpressions.Regex ObsErrorCodeRegex(); } + + diff --git a/ObsWebSocket.Example/appsettings.json b/ObsWebSocket.Example/appsettings.json index 729ec8f..3872933 100644 --- a/ObsWebSocket.Example/appsettings.json +++ b/ObsWebSocket.Example/appsettings.json @@ -17,5 +17,11 @@ // OPTIONAL: Specify event subscriptions (defaults to 'All' non-high-volume if omitted) // See ObsWebSocket.Core.Protocol.Generated.EventSubscription for flags "EventSubscriptions": null // Example: (1 << 0) | (1 << 2) for General and Scenes + }, + "ExampleValidation": { + // When true, runs JSON + MsgPack validation before entering the interactive command loop. + "RunValidationOnStartup": false, + // Number of full JSON+MsgPack passes per validation run. + "ValidationIterations": 1 } -} \ No newline at end of file +} diff --git a/ObsWebSocket.SourceGenerators/AnalyzerReleases.Shipped.md b/ObsWebSocket.SourceGenerators/AnalyzerReleases.Shipped.md deleted file mode 100644 index 60b59dd..0000000 --- a/ObsWebSocket.SourceGenerators/AnalyzerReleases.Shipped.md +++ /dev/null @@ -1,3 +0,0 @@ -; Shipped analyzer releases -; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md - diff --git a/ObsWebSocket.SourceGenerators/AnalyzerReleases.Unshipped.md b/ObsWebSocket.SourceGenerators/AnalyzerReleases.Unshipped.md deleted file mode 100644 index 4852646..0000000 --- a/ObsWebSocket.SourceGenerators/AnalyzerReleases.Unshipped.md +++ /dev/null @@ -1,16 +0,0 @@ -### New Rules - -Rule ID | Category | Severity | Notes ---------|----------|----------|------- -OBSWSGEN001 | ObsWebSocketGenerator | Error | Diagnostics -OBSWSGEN002 | ObsWebSocketGenerator | Error | Diagnostics -OBSWSGEN003 | ObsWebSocketGenerator | Error | Diagnostics -OBSWSGEN004 | ObsWebSocketGenerator | Error | Diagnostics -OBSWSGEN005 | ObsWebSocketGenerator | Error | Diagnostics -OBSWSGEN006 | ObsWebSocketGenerator | Error | Diagnostics -OBSWSGEN007 | ObsWebSocketGenerator | Warning | Diagnostics -OBSWSGEN008 | ObsWebSocketGenerator | Error | Diagnostics -OBSWSGEN009 | ObsWebSocketGenerator | Warning | Diagnostics -OBSWSGEN010 | ObsWebSocketGenerator | Warning | Diagnostics -OBSWSGEN011 | ObsWebSocketGenerator | Info | Diagnostics - diff --git a/ObsWebSocket.SourceGenerators/IsExternalInit.cs b/ObsWebSocket.SourceGenerators/IsExternalInit.cs deleted file mode 100644 index aea1b27..0000000 --- a/ObsWebSocket.SourceGenerators/IsExternalInit.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel; - -// This file is necessary for Projects targeting older frameworks like netstandard2.0 -// which don't include IsExternalInit, a type required by the C# 9+ 'init' accessor used in records. -// See: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-9.0/init -#pragma warning disable IDE0130 // Namespace does not match folder structure -namespace System.Runtime.CompilerServices; - -#pragma warning restore IDE0130 // Namespace does not match folder structure - -/// -/// Reserved to be used by the compiler for tracking metadata. -/// This class should not be used by developers in source code. -/// It allows the use of 'init' accessors in projects targeting older frameworks. -/// -[EditorBrowsable(EditorBrowsableState.Never)] -// Note: The type must be internal or public, but static is convention. -internal static class IsExternalInit { } diff --git a/ObsWebSocket.SourceGenerators/ObsWebSocket.SourceGenerators.csproj b/ObsWebSocket.SourceGenerators/ObsWebSocket.SourceGenerators.csproj deleted file mode 100644 index 873578d..0000000 --- a/ObsWebSocket.SourceGenerators/ObsWebSocket.SourceGenerators.csproj +++ /dev/null @@ -1,168 +0,0 @@ - - - netstandard2.0 - latest - enable - enable - true - true - false - Source Generators for ObsWebSocket.Core library. - true - true - - $(NoWarn);NU5128 - - - - - - - - - - - - - - - - - - - $(GetTargetPathDependsOn);GetDependencyTargetPaths - - - - - - - - - - - - - - - - - - - - - - <_ProtocolJsonUrl>https://raw.githubusercontent.com/obsproject/obs-websocket/master/docs/generated/protocol.json - <_ProtocolJsonOutputPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\protocol.json')) - <_ProtocolJsonOutputDirectory>$([System.IO.Path]::GetDirectoryName('$(_ProtocolJsonOutputPath)')) - - - - - - - - - - diff --git a/ObsWebSocket.SourceGenerators/ProtocolGenerator.cs b/ObsWebSocket.SourceGenerators/ProtocolGenerator.cs deleted file mode 100644 index 9c928b3..0000000 --- a/ObsWebSocket.SourceGenerators/ProtocolGenerator.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Text; - -namespace ObsWebSocket.SourceGenerators; - -/// -/// An Incremental Source Generator that reads OBS WebSocket protocol.json -/// and generates corresponding C# enums, DTO records, and client extension methods. -/// -[Generator(LanguageNames.CSharp)] -public sealed class ProtocolGenerator : IIncrementalGenerator -{ - private const string ProtocolFileName = "protocol.json"; - - private static readonly JsonSerializerOptions s_jsonOptions = new() - { - PropertyNameCaseInsensitive = true, - // Allow reading numbers from strings (e.g., for enum values) - NumberHandling = JsonNumberHandling.AllowReadingFromString, - }; - - /// - /// Initializes the generator and sets up the generation pipeline. - /// - public void Initialize(IncrementalGeneratorInitializationContext context) - { - // Step 1: Find protocol.json - IncrementalValueProvider protocolFileProvider = context - .AdditionalTextsProvider.Where(static at => - Path.GetFileName(at.Path) - .Equals(ProtocolFileName, StringComparison.OrdinalIgnoreCase) - ) - .Collect() - .Select(static (texts, ct) => texts.FirstOrDefault()); - - // Step 2: Read and parse protocol.json - IncrementalValueProvider<( - ProtocolDefinition? Definition, - Diagnostic? Diagnostic - )> protocolDefinitionProvider = protocolFileProvider.Select( - static (additionalText, cancellationToken) => - LoadAndParseProtocol(additionalText, cancellationToken) - ); - - // Step 3: Register source output action - context.RegisterSourceOutput( - protocolDefinitionProvider, - static (spc, result) => - { - if (result.Diagnostic is not null) - { - spc.ReportDiagnostic(result.Diagnostic); - return; - } - if (result.Definition is null) - { - return; - } - - Emitter.PreGenerateNestedDtos(spc, result.Definition); - - // Generate Enums, Top-Level DTOs, Client Extensions, Event Payloads, EventArgs, and Client Event Infrastructure - Emitter.GenerateEnums(spc, result.Definition); - Emitter.GenerateRequestDtos(spc, result.Definition); - Emitter.GenerateResponseDtos(spc, result.Definition); - Emitter.GenerateClientExtensions(spc, result.Definition); - Emitter.GenerateEventPayloads(spc, result.Definition); - Emitter.GenerateEventArgs(spc, result.Definition); - Emitter.GenerateClientEventInfrastructure(spc, result.Definition); - Emitter.GenerateWaitForEventHelper(spc, result.Definition); - } - ); - } - - private static (ProtocolDefinition? Definition, Diagnostic? Diagnostic) LoadAndParseProtocol( - AdditionalText? additionalText, - CancellationToken cancellationToken - ) - { - if (additionalText is null) - { - return (null, Diagnostic.Create(Diagnostics.ProtocolFileNotFound, Location.None)); - } - SourceText? sourceText = additionalText.GetText(cancellationToken); - if (sourceText is null) - { - return ( - null, - Diagnostic.Create( - Diagnostics.ProtocolFileReadError, - Location.None, - $"Could not get SourceText for '{additionalText.Path}'" - ) - ); - } - try - { - ProtocolDefinition? definition = JsonSerializer.Deserialize( - sourceText.ToString(), - s_jsonOptions - ); - return definition is null - ? ((ProtocolDefinition? Definition, Diagnostic? Diagnostic)) - ( - null, - Diagnostic.Create( - Diagnostics.ProtocolJsonParseError, - Location.None, - "Deserialization returned null" - ) - ) - : ((ProtocolDefinition? Definition, Diagnostic? Diagnostic))(definition, null); - } - catch (JsonException jsonEx) - { - Location location = Location.Create( - additionalText.Path, - TextSpan.FromBounds(0, 0), - new LinePositionSpan() - ); - // Add line/byte position if available in JsonException - string message = - jsonEx.LineNumber.HasValue && jsonEx.BytePositionInLine.HasValue - ? $"Failed to parse JSON at Line {jsonEx.LineNumber + 1}, Position {jsonEx.BytePositionInLine + 1}: {jsonEx.Message}" - : $"Failed to parse JSON: {jsonEx.Message}"; - return (null, Diagnostic.Create(Diagnostics.ProtocolJsonParseError, location, message)); - } - catch (Exception ex) - { - Location location = Location.Create( - additionalText.Path, - TextSpan.FromBounds(0, 0), - new LinePositionSpan() - ); - return ( - null, - Diagnostic.Create( - Diagnostics.ProtocolFileReadError, - location, - $"Unexpected error: {ex.Message}" - ) - ); - } - } -} diff --git a/ObsWebSocket.Tests/JsonMessageSerializerTests.cs b/ObsWebSocket.Tests/JsonMessageSerializerTests.cs new file mode 100644 index 0000000..1f50c8b --- /dev/null +++ b/ObsWebSocket.Tests/JsonMessageSerializerTests.cs @@ -0,0 +1,222 @@ +using System.Text.Json; +using Microsoft.Extensions.Logging.Abstractions; +using ObsWebSocket.Core.Protocol; +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Protocol.Generated; +using ObsWebSocket.Core.Serialization; + +namespace ObsWebSocket.Tests; + +[TestClass] +public class JsonMessageSerializerTests +{ + private static JsonMessageSerializer CreateSerializer() => + new(NullLogger.Instance); + + [TestMethod] + public void DeserializePayload_EventPayloadBaseObject_UsesContextBackedBridge() + { + JsonElement payload = JsonDocument + .Parse( + """ + { + "eventType": "SceneListChanged", + "eventIntent": 4, + "eventData": { + "scenes": [ + { "sceneIndex": 0, "sceneName": "Scene", "sceneUuid": "abc" } + ] + } + } + """ + ) + .RootElement.Clone(); + + EventPayloadBase? result = CreateSerializer().DeserializePayload< + EventPayloadBase + >(payload); + + Assert.IsNotNull(result); + Assert.AreEqual("SceneListChanged", result.EventType); + _ = Assert.IsInstanceOfType(result.EventData); + JsonElement eventData = (JsonElement)result.EventData; + Assert.AreEqual(JsonValueKind.Object, eventData.ValueKind); + Assert.AreEqual(1, eventData.GetProperty("scenes").GetArrayLength()); + } + + [TestMethod] + public void DeserializePayload_RequestResponsePayloadObject_UsesContextBackedBridge() + { + JsonElement payload = JsonDocument + .Parse( + """ + { + "requestType": "GetVersion", + "requestId": "req-1", + "requestStatus": { "result": true, "code": 100 }, + "responseData": { "obsVersion": "31.1.0" } + } + """ + ) + .RootElement.Clone(); + + RequestResponsePayload? result = CreateSerializer().DeserializePayload< + RequestResponsePayload + >(payload); + + Assert.IsNotNull(result); + Assert.AreEqual("GetVersion", result.RequestType); + _ = Assert.IsInstanceOfType(result.ResponseData); + JsonElement responseData = (JsonElement)result.ResponseData!; + Assert.AreEqual("31.1.0", responseData.GetProperty("obsVersion").GetString()); + } + + [TestMethod] + public void DeserializePayload_SceneListChangedPayload_DeserializesSceneStubs() + { + JsonElement payload = JsonDocument + .Parse( + """ + { + "scenes": [ + { "sceneIndex": 0, "sceneName": "Scene A", "sceneUuid": "uuid-a", "x-extra": 123 }, + { "sceneIndex": 1, "sceneName": "Scene B", "sceneUuid": "uuid-b" } + ] + } + """ + ) + .RootElement.Clone(); + + SceneListChangedPayload? result = CreateSerializer().DeserializePayload( + payload + ); + + Assert.IsNotNull(result); + Assert.IsNotNull(result.Scenes); + Assert.AreEqual(2, result.Scenes.Count); + Assert.AreEqual("Scene A", result.Scenes[0].SceneName); + Dictionary? extensionData = result.Scenes[0].ExtensionData; + Assert.IsNotNull(extensionData); + Assert.IsTrue(extensionData.ContainsKey("x-extra")); + Assert.AreEqual(123, extensionData["x-extra"].GetInt32()); + } + + [TestMethod] + public void DeserializePayload_RequestBatchResponsePayloadObject_UsesContextBackedBridge() + { + JsonElement payload = JsonDocument + .Parse( + """ + { + "requestId": "batch-1", + "results": [ + { + "requestType": "GetVersion", + "requestId": "batch-1_0", + "requestStatus": { "result": true, "code": 100 }, + "responseData": { "obsVersion": "31.1.0" } + } + ] + } + """ + ) + .RootElement.Clone(); + + RequestBatchResponsePayload? result = CreateSerializer().DeserializePayload< + RequestBatchResponsePayload + >(payload); + + Assert.IsNotNull(result); + Assert.AreEqual("batch-1", result.RequestId); + Assert.AreEqual(1, result.Results.Count); + _ = Assert.IsInstanceOfType(result.Results[0].ResponseData); + JsonElement responseData = (JsonElement)result.Results[0].ResponseData!; + Assert.AreEqual("31.1.0", responseData.GetProperty("obsVersion").GetString()); + } + + [TestMethod] + public async Task SerializeAsync_OutgoingMessage_UsesExpectedEnvelopeShape() + { + OutgoingMessage outgoing = new( + WebSocketOpCode.Request, + new RequestPayload("GetSceneList", "req-1", null) + ); + + byte[] bytes = await CreateSerializer().SerializeAsync(outgoing); + using JsonDocument document = JsonDocument.Parse(bytes); + JsonElement root = document.RootElement; + + Assert.AreEqual((int)WebSocketOpCode.Request, root.GetProperty("op").GetInt32()); + JsonElement data = root.GetProperty("d"); + Assert.AreEqual("GetSceneList", data.GetProperty("requestType").GetString()); + Assert.AreEqual("req-1", data.GetProperty("requestId").GetString()); + Assert.IsFalse(data.TryGetProperty("requestData", out _)); + } + + [TestMethod] + public async Task DeserializeAsync_ValidIncomingEnvelope_ReturnsIncomingMessage() + { + const string incomingJson = + """ + { + "op": 5, + "d": { + "eventType": "SceneListChanged", + "eventIntent": 4, + "eventData": { + "scenes": [ + { "sceneIndex": 0, "sceneName": "Scene A", "sceneUuid": "scene-a" } + ] + } + } + } + """; + await using MemoryStream stream = new(System.Text.Encoding.UTF8.GetBytes(incomingJson)); + + object? result = await CreateSerializer().DeserializeAsync(stream); + + Assert.IsNotNull(result); + _ = Assert.IsInstanceOfType>(result); + IncomingMessage incoming = (IncomingMessage)result; + Assert.AreEqual(WebSocketOpCode.Event, incoming.Op); + Assert.AreEqual("SceneListChanged", incoming.D.GetProperty("eventType").GetString()); + } + + [TestMethod] + public void DeserializeValuePayload_WebSocketOpCode_DeserializesEnumValueType() + { + JsonElement payload = JsonDocument.Parse("5").RootElement.Clone(); + + WebSocketOpCode? result = CreateSerializer().DeserializeValuePayload( + payload + ); + + Assert.IsTrue(result.HasValue); + Assert.AreEqual(WebSocketOpCode.Event, result.Value); + } + + [TestMethod] + public void DeserializePayload_RequestStatus_DeserializesFields() + { + JsonElement payload = JsonDocument + .Parse( + """ + { + "result": true, + "code": 100, + "comment": "ok" + } + """ + ) + .RootElement.Clone(); + + ObsWebSocket.Core.Protocol.RequestStatus? result = CreateSerializer().DeserializePayload< + ObsWebSocket.Core.Protocol.RequestStatus + >(payload); + + Assert.IsNotNull(result); + Assert.IsTrue(result.Result); + Assert.AreEqual(100, result.Code); + Assert.AreEqual("ok", result.Comment); + } +} diff --git a/ObsWebSocket.Tests/ObsWebSocket.Tests.csproj b/ObsWebSocket.Tests/ObsWebSocket.Tests.csproj index be13345..23cc689 100644 --- a/ObsWebSocket.Tests/ObsWebSocket.Tests.csproj +++ b/ObsWebSocket.Tests/ObsWebSocket.Tests.csproj @@ -1,6 +1,6 @@  - net9.0 + net10.0;net9.0 latest enable enable @@ -9,9 +9,9 @@ true - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -20,11 +20,11 @@ - - - - - + + + + + diff --git a/ObsWebSocket.Tests/ObsWebSocketClientConnectionTests.cs b/ObsWebSocket.Tests/ObsWebSocketClientConnectionTests.cs index edef4f8..614dbb7 100644 --- a/ObsWebSocket.Tests/ObsWebSocketClientConnectionTests.cs +++ b/ObsWebSocket.Tests/ObsWebSocketClientConnectionTests.cs @@ -49,7 +49,7 @@ IdentifiedPayload identified JsonElement rawHelloData = TestUtils.ToJsonElement(hello)!.Value; JsonElement rawIdentifiedData = TestUtils.ToJsonElement(identified)!.Value; - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload( It.Is(o => @@ -66,7 +66,7 @@ IdentifiedPayload identified ) ); - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload( It.Is(o => @@ -114,7 +114,7 @@ public async Task ConnectAsync_SuccessfulFirstAttempt_RaisesCorrectEvents() { Debug.WriteLine("--> Connected event raised"); eventLog.Add("Connected"); - connectedSignal.TrySetResult(); + _ = connectedSignal.TrySetResult(); }; client.Disconnected += (_, _) => eventLog.Add("Disconnected"); @@ -142,7 +142,7 @@ public async Task ConnectAsync_SuccessfulFirstAttempt_RaisesCorrectEvents() IdentifyPayload expectedIdentifyPayload = new(1, null, 0); // Mock Serializer - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializeAsync(It.IsAny(), It.IsAny())) .Returns( (Stream stream, CancellationToken ct) => @@ -168,7 +168,7 @@ public async Task ConnectAsync_SuccessfulFirstAttempt_RaisesCorrectEvents() new OutgoingMessage(WebSocketOpCode.Identify, expectedIdentifyPayload), TestUtils.s_jsonSerializerOptions ); - mockSerializer + _ = mockSerializer .Setup(s => s.SerializeAsync( It.Is>(m => @@ -182,7 +182,7 @@ public async Task ConnectAsync_SuccessfulFirstAttempt_RaisesCorrectEvents() .ReturnsAsync(serializedIdentifyBytes); // Mock WebSocket Connection - mockConnection + _ = mockConnection .Setup(c => c.ConnectAsync(s_testServerUri, It.IsAny())) .Callback(() => mockConnection.SetupGet(conn => conn.State).Returns(WebSocketState.Open) ) @@ -209,7 +209,7 @@ byte[] bytesToCopy ValueTask BlockReceiveAsync(CancellationToken ct) { Debug.WriteLine($"--> ReceiveAsync Mock: Blocking call {receiveCallCount}."); - ct.Register(() => blockTcs.TrySetCanceled(ct)); + _ = ct.Register(() => blockTcs.TrySetCanceled(ct)); return new ValueTask( blockTcs.Task.ContinueWith( _ => new ValueWebSocketReceiveResult(0, WebSocketMessageType.Close, true), // Return Close on completion @@ -218,7 +218,7 @@ ValueTask BlockReceiveAsync(CancellationToken ct) ); } - mockConnection + _ = mockConnection .Setup(ws => ws.ReceiveAsync(It.IsAny>(), It.IsAny())) .Returns( (Memory buffer, CancellationToken token) => @@ -234,7 +234,7 @@ ValueTask BlockReceiveAsync(CancellationToken ct) ); // Setup SendAsync - mockConnection + _ = mockConnection .Setup(c => c.SendAsync( It.IsAny>(), @@ -247,7 +247,7 @@ ValueTask BlockReceiveAsync(CancellationToken ct) .Returns(ValueTask.CompletedTask); // Mock Factory - mockFactory.Setup(f => f.CreateConnection()).Returns(mockConnection.Object); + _ = mockFactory.Setup(f => f.CreateConnection()).Returns(mockConnection.Object); // Act Task connectTask = client.ConnectAsync(); @@ -355,7 +355,7 @@ public async Task ConnectAsync_AuthFailure_NoRetry_RaisesCorrectEvents() { eventLog.Add("Disconnected"); disconnectedReason = e.ReasonException; // Assign to variable in scope - disconnectedSignal.TrySetResult(); + _ = disconnectedSignal.TrySetResult(); }; // Payloads & Messages @@ -370,19 +370,19 @@ public async Task ConnectAsync_AuthFailure_NoRetry_RaisesCorrectEvents() ); // Mock WebSocket Connection (the one the factory will return) - mockFailingConnection + _ = mockFailingConnection .Setup(c => c.ConnectAsync(s_testServerUri, It.IsAny())) .Callback(() => mockFailingConnection.SetupGet(conn => conn.State).Returns(WebSocketState.Open) ) .Returns(Task.CompletedTask); - mockFailingConnection.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); // Setup required by Strict behavior - mockFailingConnection.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); // Setup required by Strict behavior - mockFailingConnection.Setup(c => c.Abort()); // Needed for cleanup path - mockFailingConnection.Setup(c => c.Dispose()); // Needed for cleanup path + _ = mockFailingConnection.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); // Setup required by Strict behavior + _ = mockFailingConnection.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); // Setup required by Strict behavior + _ = mockFailingConnection.Setup(c => c.Abort()); // Needed for cleanup path + _ = mockFailingConnection.Setup(c => c.Dispose()); // Needed for cleanup path // Initial state is None, transitions to Open after ConnectAsync callback - mockFailingConnection + _ = mockFailingConnection .SetupSequence(c => c.State) .Returns(WebSocketState.None) // Before ConnectAsync .Returns(WebSocketState.Open) // After ConnectAsync callback @@ -390,7 +390,7 @@ public async Task ConnectAsync_AuthFailure_NoRetry_RaisesCorrectEvents() // Setup ReceiveAsync using counter int receiveCallCount = 0; - mockFailingConnection + _ = mockFailingConnection .Setup(ws => ws.ReceiveAsync(It.IsAny>(), It.IsAny())) .Returns( (Memory buffer, CancellationToken token) => @@ -410,13 +410,13 @@ public async Task ConnectAsync_AuthFailure_NoRetry_RaisesCorrectEvents() else // Block subsequent calls { TaskCompletionSource blockReceiveTcs = new(); - token.Register(() => blockReceiveTcs.TrySetCanceled(token)); + _ = token.Register(() => blockReceiveTcs.TrySetCanceled(token)); return new ValueTask(blockReceiveTcs.Task); } } ); // SendAsync should NOT be called - mockFailingConnection + _ = mockFailingConnection .Setup(c => c.SendAsync( It.IsAny>(), @@ -432,7 +432,7 @@ public async Task ConnectAsync_AuthFailure_NoRetry_RaisesCorrectEvents() ); // Mock Serializer - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializeAsync(It.IsAny(), It.IsAny())) .ReturnsAsync( (Stream stream, CancellationToken ct) => @@ -456,7 +456,7 @@ public async Task ConnectAsync_AuthFailure_NoRetry_RaisesCorrectEvents() ); // Mock Factory - Crucially, return the mock we created and setup above - mockFactory.Setup(f => f.CreateConnection()).Returns(mockFailingConnection.Object); + _ = mockFactory.Setup(f => f.CreateConnection()).Returns(mockFailingConnection.Object); // Act & Assert AuthenticationFailureException thrownException = @@ -542,23 +542,23 @@ public async Task ConnectAsync_ConnectionFailedFirstAttempt_NoRetry_RaisesCorrec { eventLog.Add("Disconnected"); disconnectedReason = e.ReasonException; // Assign to variable in scope - disconnectedSignal.TrySetResult(); + _ = disconnectedSignal.TrySetResult(); }; // Setup the failing connection mock - mockFailingConnection.SetupGet(c => c.State).Returns(WebSocketState.None); - mockFailingConnection.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); - mockFailingConnection.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); - mockFailingConnection.SetupGet(c => c.CloseStatus).Returns((WebSocketCloseStatus?)null); - mockFailingConnection.SetupGet(c => c.CloseStatusDescription).Returns((string?)null); - mockFailingConnection + _ = mockFailingConnection.SetupGet(c => c.State).Returns(WebSocketState.None); + _ = mockFailingConnection.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); + _ = mockFailingConnection.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); + _ = mockFailingConnection.SetupGet(c => c.CloseStatus).Returns((WebSocketCloseStatus?)null); + _ = mockFailingConnection.SetupGet(c => c.CloseStatusDescription).Returns((string?)null); + _ = mockFailingConnection .Setup(c => c.ConnectAsync(s_testServerUri, It.IsAny())) .ThrowsAsync(connectException); // Setup ConnectAsync to throw - mockFailingConnection.Setup(c => c.Abort()); // Needed for cleanup - mockFailingConnection.Setup(c => c.Dispose()); // Needed for cleanup + _ = mockFailingConnection.Setup(c => c.Abort()); // Needed for cleanup + _ = mockFailingConnection.Setup(c => c.Dispose()); // Needed for cleanup // Setup the factory to return *this specific* failing connection mock - mockFactory.Setup(f => f.CreateConnection()).Returns(mockFailingConnection.Object); + _ = mockFactory.Setup(f => f.CreateConnection()).Returns(mockFailingConnection.Object); // Act & Assert ConnectionAttemptFailedException thrownException = @@ -569,7 +569,7 @@ await Assert.ThrowsExactlyAsync(() => await Task.Delay(50); // Allow brief moment for background event processing Assert.AreEqual(connectException, thrownException.InnerException); - await Task.WhenAny(disconnectedSignal.Task, Task.Delay(1000)) + _ = await Task.WhenAny(disconnectedSignal.Task, Task.Delay(1000)) .WaitAsync(TimeSpan.FromSeconds(2)); CollectionAssert.AreEqual( @@ -579,7 +579,7 @@ await Task.WhenAny(disconnectedSignal.Task, Task.Delay(1000)) Assert.IsFalse(client.IsConnected); Assert.IsNotNull(disconnectedReason, "DisconnectedReason should not be null."); - Assert.IsInstanceOfType(disconnectedReason); + _ = Assert.IsInstanceOfType(disconnectedReason); Assert.IsInstanceOfType( disconnectedReason.InnerException ); @@ -620,25 +620,25 @@ public async Task ConnectAsync_FailAllRetries_RaisesDisconnectedWithLastError() { eventLog.Add("Disconnected"); disconnectedReason = e.ReasonException; - disconnectedSignal.TrySetResult(); + _ = disconnectedSignal.TrySetResult(); }; // Setup the factory to return failing connections - mockFactory + _ = mockFactory .Setup(f => f.CreateConnection()) .Returns(() => { Mock mockConnFailing = new(MockBehavior.Strict); - mockConnFailing.SetupGet(c => c.State).Returns(WebSocketState.None); - mockConnFailing.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); - mockConnFailing.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); - mockConnFailing.SetupGet(c => c.CloseStatus).Returns((WebSocketCloseStatus?)null); - mockConnFailing.SetupGet(c => c.CloseStatusDescription).Returns((string?)null); - mockConnFailing + _ = mockConnFailing.SetupGet(c => c.State).Returns(WebSocketState.None); + _ = mockConnFailing.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); + _ = mockConnFailing.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); + _ = mockConnFailing.SetupGet(c => c.CloseStatus).Returns((WebSocketCloseStatus?)null); + _ = mockConnFailing.SetupGet(c => c.CloseStatusDescription).Returns((string?)null); + _ = mockConnFailing .Setup(c => c.ConnectAsync(s_testServerUri, It.IsAny())) .ThrowsAsync(connectException); - mockConnFailing.Setup(c => c.Abort()); - mockConnFailing.Setup(c => c.Dispose()); + _ = mockConnFailing.Setup(c => c.Abort()); + _ = mockConnFailing.Setup(c => c.Dispose()); return mockConnFailing.Object; }); @@ -652,7 +652,7 @@ public async Task ConnectAsync_FailAllRetries_RaisesDisconnectedWithLastError() Assert.IsInstanceOfType(thrownException.InnerException); Assert.AreEqual(connectException, thrownException.InnerException!.InnerException); - await Task.WhenAny(disconnectedSignal.Task, Task.Delay(1000)) + _ = await Task.WhenAny(disconnectedSignal.Task, Task.Delay(1000)) .WaitAsync(TimeSpan.FromSeconds(2)); // Generate expected log dynamically based on maxAttempts @@ -668,7 +668,7 @@ await Task.WhenAny(disconnectedSignal.Task, Task.Delay(1000)) Assert.IsFalse(client.IsConnected); Assert.IsNotNull(disconnectedReason, "DisconnectedReason should not be null."); - Assert.IsInstanceOfType(disconnectedReason); + _ = Assert.IsInstanceOfType(disconnectedReason); Assert.AreEqual(thrownException.Message, disconnectedReason.Message); mockFactory.Verify(f => f.CreateConnection(), Times.Exactly(maxAttempts)); @@ -703,31 +703,31 @@ public async Task DisconnectAsync_DuringRetry_StopsRetriesAndDisconnectsGraceful eventLog.Add($"Failed_{e.AttemptNumber}"); if (e.AttemptNumber == 1) { - firstFailSignal.TrySetResult(); // Signal after first failure + _ = firstFailSignal.TrySetResult(); // Signal after first failure } }; client.Disconnected += (_, e) => { eventLog.Add("Disconnected"); disconnectedReason = e.ReasonException; - disconnectedSignal.TrySetResult(); + _ = disconnectedSignal.TrySetResult(); }; - mockFactory + _ = mockFactory .Setup(f => f.CreateConnection()) .Returns(() => { Mock mockConnFailing = new(MockBehavior.Strict); - mockConnFailing.SetupGet(c => c.State).Returns(WebSocketState.None); - mockConnFailing.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); - mockConnFailing.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); - mockConnFailing.SetupGet(c => c.CloseStatus).Returns((WebSocketCloseStatus?)null); - mockConnFailing.SetupGet(c => c.CloseStatusDescription).Returns((string?)null); - mockConnFailing + _ = mockConnFailing.SetupGet(c => c.State).Returns(WebSocketState.None); + _ = mockConnFailing.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); + _ = mockConnFailing.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); + _ = mockConnFailing.SetupGet(c => c.CloseStatus).Returns((WebSocketCloseStatus?)null); + _ = mockConnFailing.SetupGet(c => c.CloseStatusDescription).Returns((string?)null); + _ = mockConnFailing .Setup(c => c.ConnectAsync(s_testServerUri, It.IsAny())) .ThrowsAsync(connectException); - mockConnFailing.Setup(c => c.Abort()); - mockConnFailing.Setup(c => c.Dispose()); + _ = mockConnFailing.Setup(c => c.Abort()); + _ = mockConnFailing.Setup(c => c.Dispose()); return mockConnFailing.Object; }); @@ -792,21 +792,21 @@ public async Task ConnectAsync_InfiniteRetries_AttemptsMultipleTimes() } }; - mockFactory + _ = mockFactory .Setup(f => f.CreateConnection()) .Returns(() => { Mock mockConnFailing = new(MockBehavior.Strict); - mockConnFailing.SetupGet(c => c.State).Returns(WebSocketState.None); - mockConnFailing.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); - mockConnFailing.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); - mockConnFailing.SetupGet(c => c.CloseStatus).Returns((WebSocketCloseStatus?)null); - mockConnFailing.SetupGet(c => c.CloseStatusDescription).Returns((string?)null); - mockConnFailing + _ = mockConnFailing.SetupGet(c => c.State).Returns(WebSocketState.None); + _ = mockConnFailing.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); + _ = mockConnFailing.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); + _ = mockConnFailing.SetupGet(c => c.CloseStatus).Returns((WebSocketCloseStatus?)null); + _ = mockConnFailing.SetupGet(c => c.CloseStatusDescription).Returns((string?)null); + _ = mockConnFailing .Setup(c => c.ConnectAsync(s_testServerUri, It.IsAny())) .ThrowsAsync(connectException); - mockConnFailing.Setup(c => c.Abort()); - mockConnFailing.Setup(c => c.Dispose()); + _ = mockConnFailing.Setup(c => c.Abort()); + _ = mockConnFailing.Setup(c => c.Dispose()); return mockConnFailing.Object; }); @@ -842,7 +842,7 @@ public async Task ConnectAsync_InfiniteRetries_AttemptsMultipleTimes() // Assert // Expect TaskCanceledException because we cancelled the token *passed into* ConnectAsync - await Assert.ThrowsExactlyAsync(() => connectTask); + _ = await Assert.ThrowsExactlyAsync(() => connectTask); int finalAttemptCount = Volatile.Read(ref attemptCounter); Assert.IsTrue( diff --git a/ObsWebSocket.Tests/ObsWebSocketClientEventTests.cs b/ObsWebSocket.Tests/ObsWebSocketClientEventTests.cs index 0cad701..9e0b944 100644 --- a/ObsWebSocket.Tests/ObsWebSocketClientEventTests.cs +++ b/ObsWebSocket.Tests/ObsWebSocketClientEventTests.cs @@ -54,7 +54,7 @@ private static TaskCompletionSource SetupSingleRece TaskCreationOptions.RunContinuationsAsynchronously ); - mockWebSocket + _ = mockWebSocket .Setup(ws => ws.ReceiveAsync(It.IsAny>(), It.IsAny())) .Returns( (Memory buffer, CancellationToken ct) => @@ -86,10 +86,10 @@ private static TaskCompletionSource SetupSingleRece $"--> ReceiveAsync Mock: Blocking call {receiveCallCount}." ); // Register cancellation to ensure the TCS doesn't block indefinitely if the test is cancelled - ct.Register(() => + _ = ct.Register(() => { Debug.WriteLine("--> ReceiveAsync block cancelled by token."); - blockTcs.TrySetCanceled(ct); + _ = blockTcs.TrySetCanceled(ct); }); // Return the TCS task, which will complete only when set (or cancelled) return new ValueTask( @@ -198,8 +198,18 @@ public async Task HandleEventMessage_SceneListChanged_RaisesCorrectEvent() Mock? mockWebSocket ) = TestUtils.SetupConnectedClientForceState(); - SceneStub scene1Data = new("Scene 1", Guid.NewGuid().ToString(), 1); - SceneStub scene2Data = new("Scene 2", Guid.NewGuid().ToString(), 2); + SceneStub scene1Data = new() + { + SceneName = "Scene 1", + SceneUuid = Guid.NewGuid().ToString(), + SceneIndex = 1, + }; + SceneStub scene2Data = new() + { + SceneName = "Scene 2", + SceneUuid = Guid.NewGuid().ToString(), + SceneIndex = 2, + }; List sceneListElements = [scene1Data, scene2Data]; @@ -228,14 +238,14 @@ public async Task HandleEventMessage_SceneListChanged_RaisesCorrectEvent() client.SceneListChanged += (_, args) => { receivedArgs = args; - eventReceivedSignal.TrySetResult(); + _ = eventReceivedSignal.TrySetResult(); }; // Mock Serializer - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializeAsync(It.IsAny(), It.IsAny())) .ReturnsAsync(incomingMessage); - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload>(It.Is(o => o is JsonElement)) ) @@ -246,7 +256,7 @@ public async Task HandleEventMessage_SceneListChanged_RaisesCorrectEvent() innerEventDataJsonElement ) ); - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload( It.Is(o => @@ -259,8 +269,8 @@ o is JsonElement // Mock WebSocket mockWebSocket.Reset(); // Reset setups from helper - mockWebSocket.SetupGet(c => c.State).Returns(WebSocketState.Open); - SetupSingleReceiveAndBlock(mockWebSocket, messageBytes); // Setup receive sequence + _ = mockWebSocket.SetupGet(c => c.State).Returns(WebSocketState.Open); + _ = SetupSingleReceiveAndBlock(mockWebSocket, messageBytes); // Setup receive sequence // Act Task receiveLoopTask = StartReceiveLoopAsync(client); @@ -339,14 +349,14 @@ public async Task HandleEventMessage_StudioModeStateChanged_RaisesCorrectEvent() client.StudioModeStateChanged += (_, args) => { receivedArgs = args; - eventReceivedSignal.TrySetResult(); + _ = eventReceivedSignal.TrySetResult(); }; // Mock Serializer - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializeAsync(It.IsAny(), It.IsAny())) .ReturnsAsync(incomingMessage); - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload>(It.Is(o => o is JsonElement)) ) @@ -357,7 +367,7 @@ public async Task HandleEventMessage_StudioModeStateChanged_RaisesCorrectEvent() innerEventDataJsonElement ) ); - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload( It.Is(o => @@ -370,8 +380,8 @@ o is JsonElement // Mock WebSocket mockWebSocket.Reset(); - mockWebSocket.SetupGet(c => c.State).Returns(WebSocketState.Open); - SetupSingleReceiveAndBlock(mockWebSocket, messageBytes); + _ = mockWebSocket.SetupGet(c => c.State).Returns(WebSocketState.Open); + _ = SetupSingleReceiveAndBlock(mockWebSocket, messageBytes); // Act Task receiveLoopTask = StartReceiveLoopAsync(client); @@ -451,15 +461,15 @@ public async Task HandleEventMessage_ExitStarted_RaisesCorrectEvent() client.ExitStarted += (_, args) => { receivedArgs = args; - eventReceivedSignal.TrySetResult(); + _ = eventReceivedSignal.TrySetResult(); }; // Mock Serializer - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializeAsync(It.IsAny(), It.IsAny())) .ReturnsAsync(incomingMessage); // Mock only the base deserialization, as EventData is null - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload>(It.Is(o => o is JsonElement)) ) @@ -469,8 +479,8 @@ public async Task HandleEventMessage_ExitStarted_RaisesCorrectEvent() // Mock WebSocket mockWebSocket.Reset(); - mockWebSocket.SetupGet(c => c.State).Returns(WebSocketState.Open); - SetupSingleReceiveAndBlock(mockWebSocket, messageBytes); + _ = mockWebSocket.SetupGet(c => c.State).Returns(WebSocketState.Open); + _ = SetupSingleReceiveAndBlock(mockWebSocket, messageBytes); // Act Task receiveLoopTask = StartReceiveLoopAsync(client); @@ -544,11 +554,11 @@ public async Task HandleEventMessage_UnhandledEventType_DoesNotThrowAndLogsWarni ); // --- Mock Serializer --- - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializeAsync(It.IsAny(), It.IsAny())) .ReturnsAsync(incomingMessage); // Mock ONLY the base deserialization - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload>(It.Is(o => o is JsonElement)) ) @@ -556,7 +566,7 @@ public async Task HandleEventMessage_UnhandledEventType_DoesNotThrowAndLogsWarni // --- Mock WebSocket --- mockWebSocket.Reset(); - mockWebSocket.SetupGet(c => c.State).Returns(WebSocketState.Open); + _ = mockWebSocket.SetupGet(c => c.State).Returns(WebSocketState.Open); TaskCompletionSource blockTcs = SetupSingleReceiveAndBlock( mockWebSocket, messageBytes @@ -657,11 +667,11 @@ public async Task HandleEventMessage_PayloadDeserializationThrows_LogsError() ); // --- Mock Serializer --- - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializeAsync(It.IsAny(), It.IsAny())) .ReturnsAsync(incomingMessage); // Base deserialization succeeds - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload>(It.Is(o => o is JsonElement)) ) @@ -673,7 +683,7 @@ public async Task HandleEventMessage_PayloadDeserializationThrows_LogsError() ) ); // Specific payload deserialization *throws* - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload( It.Is(o => o is JsonElement) @@ -683,7 +693,7 @@ public async Task HandleEventMessage_PayloadDeserializationThrows_LogsError() // --- Mock WebSocket --- mockWebSocket.Reset(); - mockWebSocket.SetupGet(c => c.State).Returns(WebSocketState.Open); + _ = mockWebSocket.SetupGet(c => c.State).Returns(WebSocketState.Open); TaskCompletionSource blockTcs = SetupSingleReceiveAndBlock( mockWebSocket, messageBytes diff --git a/ObsWebSocket.Tests/ObsWebSocketClientIntegrationTests.cs b/ObsWebSocket.Tests/ObsWebSocketClientIntegrationTests.cs index ede27d3..a5e948a 100644 --- a/ObsWebSocket.Tests/ObsWebSocketClientIntegrationTests.cs +++ b/ObsWebSocket.Tests/ObsWebSocketClientIntegrationTests.cs @@ -7,9 +7,11 @@ using Microsoft.Extensions.Options; using ObsWebSocket.Core; using ObsWebSocket.Core.Events.Generated; +using ObsWebSocket.Core.Networking; using ObsWebSocket.Core.Protocol.Common; using ObsWebSocket.Core.Protocol.Requests; using ObsWebSocket.Core.Protocol.Responses; +using ObsWebSocket.Core.Serialization; namespace ObsWebSocket.Tests; @@ -42,13 +44,13 @@ public static void ClassInitialize(TestContext context) .Build(); ServiceCollection services = new(); - services.AddLogging(builder => builder.AddConsole().SetMinimumLevel(minLogLevel)); + _ = services.AddLogging(builder => builder.AddConsole().SetMinimumLevel(minLogLevel)); // Bind the "ObsIntegration" section from configuration to the options class - services.Configure(configuration.GetSection("ObsIntegration")); + _ = services.Configure(configuration.GetSection("ObsIntegration")); // Configure ObsWebSocketClientOptions based on ObsIntegrationTestOptions - services + _ = services .AddOptions() .Configure>( (coreOptions, testOpts) => @@ -61,7 +63,7 @@ public static void ClassInitialize(TestContext context) ); // Add the OBS WebSocket client services - services.AddObsWebSocketClient(); + _ = services.AddObsWebSocketClient(); s_serviceProvider = services.BuildServiceProvider(); s_testOptions = s_serviceProvider @@ -90,7 +92,7 @@ static void ValidateOption(string? value, string name) ValidateOption(s_testOptions.TestAudioInputName, nameof(s_testOptions.TestAudioInputName)); } - [ClassCleanup(ClassCleanupBehavior.EndOfClass)] + [ClassCleanup] public static async Task ClassCleanup() { if (s_serviceProvider is IAsyncDisposable asyncDisposable) @@ -103,8 +105,23 @@ public static async Task ClassCleanup() } } - private static ObsWebSocketClient CreateClient() => - s_serviceProvider.GetRequiredService(); + private static ObsWebSocketClient CreateClient() + { + ILogger logger = s_serviceProvider.GetRequiredService< + ILogger + >(); + IWebSocketMessageSerializer serializer = s_serviceProvider.GetRequiredService< + IWebSocketMessageSerializer + >(); + IOptions options = s_serviceProvider.GetRequiredService< + IOptions + >(); + IWebSocketConnectionFactory connectionFactory = s_serviceProvider.GetRequiredService< + IWebSocketConnectionFactory + >(); + + return new ObsWebSocketClient(logger, serializer, options, connectionFactory); + } // --- Test Cases --- @@ -280,7 +297,7 @@ public async Task Event_CurrentProgramSceneChanged_WhenTriggeredManually() $"--> Integration Test: Received CurrentProgramSceneChanged event for scene '{args.EventData.SceneName}'" ); changedToSceneName = args.EventData.SceneName; - tcs.TrySetResult(args); // Signal that the event was received + _ = tcs.TrySetResult(args); // Signal that the event was received }; await client.ConnectAsync(); @@ -488,7 +505,7 @@ public async Task GetInputAudioTracks_ReturnsDictionary() response.InputAudioTracks.ContainsKey(i.ToString()), $"Track '{i}' not found in dictionary." ); - Assert.IsInstanceOfType( + _ = Assert.IsInstanceOfType( response.InputAudioTracks[i.ToString()], $"Track '{i}' value is not a boolean." ); @@ -750,7 +767,7 @@ public async Task Event_SceneListChanged_ReceivesStubList() { Trace.WriteLine($"--> Integration Test: Received SceneListChanged event."); receivedArgs = args; - tcs.TrySetResult(args); // Signal that the event was received + _ = tcs.TrySetResult(args); // Signal that the event was received }; await client.ConnectAsync(); diff --git a/ObsWebSocket.Tests/ObsWebSocketClientRequestTests.cs b/ObsWebSocket.Tests/ObsWebSocketClientRequestTests.cs index c621170..3832be0 100644 --- a/ObsWebSocket.Tests/ObsWebSocketClientRequestTests.cs +++ b/ObsWebSocket.Tests/ObsWebSocketClientRequestTests.cs @@ -1,4 +1,4 @@ -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Net.WebSockets; using System.Text.Json; using Moq; @@ -53,7 +53,7 @@ public async Task GetVersionAsync_SendsCorrectRequest_ReturnsDeserializedRespons string? capturedRequestId = null; // Mock the SendAsync call to capture the request ID and simulate a successful response - mockWebSocket + _ = mockWebSocket .Setup(ws => ws.SendAsync( It.IsAny>(), @@ -91,14 +91,14 @@ CancellationToken ct ), ResponseData: rawResponseData.Value // Pass the JsonElement payload ); - TestUtils.SimulateIncomingResponse(client, capturedRequestId, response); + _ = TestUtils.SimulateIncomingResponse(client, capturedRequestId, response); } } ) .Returns(ValueTask.CompletedTask); // Mock the DeserializePayload call for the specific response type - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload( It.Is(o => @@ -175,7 +175,7 @@ public async Task SetCurrentProgramSceneAsync_SendsCorrectRequest_CompletesSucce byte[]? sentRequestBytes = null; // Capture raw bytes for deeper inspection if needed // Mock SendAsync to capture ID and simulate success response - mockWebSocket + _ = mockWebSocket .Setup(ws => ws.SendAsync( It.IsAny>(), @@ -209,14 +209,14 @@ CancellationToken ct ), ResponseData: rawResponseData // null ); - TestUtils.SimulateIncomingResponse(client, capturedRequestId, response); + _ = TestUtils.SimulateIncomingResponse(client, capturedRequestId, response); } } ) .Returns(ValueTask.CompletedTask); // Mock the DeserializePayload call for the response (expecting null or default for object) - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload(It.IsAny())) .Returns((object?)null); // Explicitly return null for clarity @@ -279,7 +279,7 @@ public async Task GetInputMuteAsync_SendsRequest_ReturnsCorrectDto() string? capturedRequestId = null; // Mock SendAsync - mockWebSocket + _ = mockWebSocket .Setup(ws => ws.SendAsync( It.IsAny>(), @@ -312,14 +312,14 @@ CancellationToken ct ), ResponseData: rawResponseData.Value // Pass JsonElement payload ); - TestUtils.SimulateIncomingResponse(client, capturedRequestId, response); + _ = TestUtils.SimulateIncomingResponse(client, capturedRequestId, response); } } ) .Returns(ValueTask.CompletedTask); // Mock the specific response DTO deserialization - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload( It.Is(o => @@ -398,7 +398,7 @@ public async Task RequestExtension_FailureResponse_ThrowsObsWebSocketException() string? capturedRequestId = null; // Mock SendAsync to simulate the failure response - mockWebSocket + _ = mockWebSocket .Setup(ws => ws.SendAsync( It.IsAny>(), @@ -429,20 +429,20 @@ CancellationToken ct RequestStatus: failureStatus, // The failure status ResponseData: rawResponseData ); - TestUtils.SimulateIncomingResponse(client, capturedRequestId, response); + _ = TestUtils.SimulateIncomingResponse(client, capturedRequestId, response); } } ) .Returns(ValueTask.CompletedTask); // Mock DeserializePayload for the s_expectedFailNoRetryLog (but not received) success payload type - It should return null/default - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload(It.IsAny())) .Returns((GetVersionResponseData?)null); // Act & Assert // Verify that calling the client method throws the correct exception - ObsWebSocketException ex = await Assert.ThrowsExceptionAsync( + ObsWebSocketException ex = await Assert.ThrowsExactlyAsync( async () => await client.GetVersionAsync() // Call the specific extension method ); @@ -504,7 +504,7 @@ public async Task RequestExtension_TimeoutViaCallerToken_ThrowsTaskCanceledExcep string? capturedRequestId = null; // Mock SendAsync: Capture request ID but DO NOT simulate a response coming back - mockWebSocket + _ = mockWebSocket .Setup(ws => ws.SendAsync( It.IsAny>(), @@ -534,11 +534,11 @@ CancellationToken ct // Act & Assert // Expect TaskCanceledException because the CancellationToken passed to GetVersionAsync will be cancelled. - await Assert.ThrowsExceptionAsync( + _ = await Assert.ThrowsExactlyAsync( async () => { using CancellationTokenSource cts = new(timeoutMs); // Create token source with short delay - await client.GetVersionAsync(cts.Token); // Pass the token + _ = await client.GetVersionAsync(cts.Token); // Pass the token }, "Expected TaskCanceledException when caller token times out." ); @@ -626,3 +626,4 @@ TRequestData expectedData } // Ignore errors } } + diff --git a/ObsWebSocket.Tests/ObsWebSocketClientTests.cs b/ObsWebSocket.Tests/ObsWebSocketClientTests.cs index d8fc560..f73580b 100644 --- a/ObsWebSocket.Tests/ObsWebSocketClientTests.cs +++ b/ObsWebSocket.Tests/ObsWebSocketClientTests.cs @@ -1,4 +1,4 @@ -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Net.WebSockets; using System.Text.Json; using Moq; @@ -6,6 +6,7 @@ using ObsWebSocket.Core.Networking; using ObsWebSocket.Core.Protocol; using ObsWebSocket.Core.Protocol.Generated; +using ObsWebSocket.Core.Protocol.Requests; using ObsWebSocket.Core.Protocol.Responses; // Required for DTOs like GetVersionResponseData using ObsWebSocket.Core.Serialization; using RequestStatus = ObsWebSocket.Core.Protocol.RequestStatus; // Alias @@ -31,7 +32,7 @@ public async Task CallBatchAsync_NullRequests_ThrowsArgumentNullException() (ObsWebSocketClient client, _, _) = TestUtils.SetupConnectedClientForceState(); // Act & Assert - await Assert.ThrowsExceptionAsync(async () => + _ = await Assert.ThrowsExactlyAsync(async () => await client.CallBatchAsync(null!) // Pass null directly ); } @@ -64,7 +65,7 @@ public async Task CallBatchAsync_InvalidRequestType_ThrowsArgumentException() List requests = [new("", null)]; // Item with empty RequestType // Act & Assert - ArgumentException ex = await Assert.ThrowsExceptionAsync(async () => + ArgumentException ex = await Assert.ThrowsExactlyAsync(async () => await client.CallBatchAsync(requests) ); Assert.IsTrue( @@ -78,6 +79,56 @@ await client.CallBatchAsync(requests) ); } + /// + /// Verifies that arbitrary anonymous objects in batch request data are rejected to keep serialization AOT-safe. + /// + [TestMethod] + public async Task CallBatchAsync_AnonymousRequestData_ThrowsObsWebSocketException() + { + // Arrange + ( + ObsWebSocketClient client, + _, + Mock mockWebSocket + ) = TestUtils.SetupConnectedClientForceState(); + + List requests = + [ + new("GetInputList", new { inputKind = "text_gdiplus_v3" }), + ]; + + // Act + ObsWebSocketException ex = await Assert.ThrowsExactlyAsync(async () => + await client.CallBatchAsync(requests) + ); + + // Assert + bool outerHasExpectedMessage = ex.Message.Contains( + "Failed to serialize request data", + StringComparison.Ordinal + ); + bool innerHasExpectedMessage = ex.InnerException?.Message.Contains( + "Failed to serialize request data", + StringComparison.Ordinal + ) == true; + Assert.IsTrue( + outerHasExpectedMessage || innerHasExpectedMessage, + "Exception chain should indicate request data serialization failure." + ); + + mockWebSocket.Verify( + ws => + ws.SendAsync( + It.IsAny>(), + It.IsAny(), + true, + It.IsAny() + ), + Times.Never, + "No message should be sent when request data cannot be serialized." + ); + } + /// /// Verifies that CallBatchAsync correctly serializes and sends a batch request message, /// processes the corresponding batch response, and returns the results. @@ -95,8 +146,7 @@ public async Task CallBatchAsync_ValidRequest_SendsCorrectBatchMessage() // Define the batch items BatchRequestItem request1 = new("GetVersion", null); - // Ensure request data uses anonymous objects or concrete DTOs that System.Text.Json can serialize - var request2Data = new { sceneName = "OldScene", newSceneName = "NewScene" }; + SetSceneNameRequestData request2Data = new("OldScene", "NewScene"); BatchRequestItem request2 = new("SetSceneName", request2Data); List requests = [request1, request2]; @@ -125,7 +175,7 @@ public async Task CallBatchAsync_ValidRequest_SendsCorrectBatchMessage() byte[]? sentBytes = null; // Capture the serialized batch message bytes // Mock SendAsync: Capture the request ID and simulate the batch response - mockWebSocket + _ = mockWebSocket .Setup(ws => ws.SendAsync( It.IsAny>(), @@ -165,7 +215,7 @@ CancellationToken ct ); // Simulate the batch response arriving - TestUtils.SimulateIncomingResponse( + _ = TestUtils.SimulateIncomingResponse( client, capturedBatchRequestId, simulatedBatchResponse @@ -176,7 +226,7 @@ CancellationToken ct .Returns(ValueTask.CompletedTask); // Mock DeserializePayload for the batch response structure - mockSerializer + _ = mockSerializer .Setup(s => s.DeserializePayload>(It.IsAny()) ) @@ -248,13 +298,13 @@ CancellationToken ct req2SentData.TryGetProperty("sceneName", out JsonElement sceneNameElement), "sceneName property missing" ); - Assert.AreEqual(request2Data.sceneName, sceneNameElement.GetString()); + Assert.AreEqual(request2Data.SceneName, sceneNameElement.GetString()); Assert.IsTrue( req2SentData.TryGetProperty("newSceneName", out JsonElement newSceneNameElement), "newSceneName property missing" ); - Assert.AreEqual(request2Data.newSceneName, newSceneNameElement.GetString()); + Assert.AreEqual(request2Data.NewSceneName, newSceneNameElement.GetString()); } catch (Exception ex) { @@ -288,7 +338,7 @@ public async Task CallBatchAsync_Timeout_ThrowsObsWebSocketException() string? capturedBatchRequestId = null; // Mock SendAsync: Capture ID but DO NOT simulate a response - mockWebSocket + _ = mockWebSocket .Setup(ws => ws.SendAsync( It.IsAny>(), @@ -317,7 +367,7 @@ CancellationToken ct .Returns(ValueTask.CompletedTask); // Act & Assert - ObsWebSocketException ex = await Assert.ThrowsExceptionAsync( + ObsWebSocketException ex = await Assert.ThrowsExactlyAsync( async () => await client.CallBatchAsync(requests, timeoutMs: timeoutMs) // Use the timeout override ); @@ -326,7 +376,7 @@ CancellationToken ct ex.Message.Contains("timed out", StringComparison.OrdinalIgnoreCase), "Exception message should indicate timeout." ); - Assert.IsInstanceOfType( + _ = Assert.IsInstanceOfType( ex.InnerException, "Inner exception should be OperationCanceledException." ); @@ -377,3 +427,4 @@ private static bool IsRequestType(ReadOnlyMemory buffer, WebSocketOpCode o } // Ignore deserialization errors } } + diff --git a/ObsWebSocket.Tests/ObsWebSocketDiTests.cs b/ObsWebSocket.Tests/ObsWebSocketDiTests.cs index 14d1b36..119b1cb 100644 --- a/ObsWebSocket.Tests/ObsWebSocketDiTests.cs +++ b/ObsWebSocket.Tests/ObsWebSocketDiTests.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; @@ -23,8 +23,8 @@ private static ServiceCollection CreateServiceCollectionWithLogging() { ServiceCollection services = new(); // Add minimal logging provider (NullLogger) for tests not verifying log output - services.AddSingleton(); - services.AddSingleton(typeof(ILogger<>), typeof(NullLogger<>)); + _ = services.AddSingleton(); + _ = services.AddSingleton(typeof(ILogger<>), typeof(NullLogger<>)); return services; } @@ -39,7 +39,7 @@ public void AddObsWebSocketClient_RegistersServicesCorrectly() ServiceCollection services = CreateServiceCollectionWithLogging(); // Act - services.AddObsWebSocketClient(); // Register the client and its dependencies + _ = services.AddObsWebSocketClient(); // Register the client and its dependencies ServiceProvider provider = services.BuildServiceProvider(); // Build the container // Assert @@ -53,7 +53,7 @@ public void AddObsWebSocketClient_RegistersServicesCorrectly() // Verify concrete implementations are registered (as singletons) Assert.IsNotNull(provider.GetService()); Assert.IsNotNull(provider.GetService()); - Assert.IsInstanceOfType( + _ = Assert.IsInstanceOfType( provider.GetRequiredService() ); @@ -80,7 +80,7 @@ public void AddObsWebSocketClient_DefaultFormat_ResolvesJsonSerializer() { // Arrange ServiceCollection services = CreateServiceCollectionWithLogging(); - services.AddObsWebSocketClient(); // Use default options + _ = services.AddObsWebSocketClient(); // Use default options ServiceProvider provider = services.BuildServiceProvider(); // Act @@ -92,14 +92,14 @@ public void AddObsWebSocketClient_DefaultFormat_ResolvesJsonSerializer() // Assert // Check the resolved interface type Assert.IsNotNull(resolvedSerializer); - Assert.IsInstanceOfType(resolvedSerializer); + _ = Assert.IsInstanceOfType(resolvedSerializer); // Check the serializer injected into the client instance Assert.IsNotNull(resolvedClient); IWebSocketMessageSerializer? injectedSerializer = TestUtils.GetPrivateField(resolvedClient, "_serializer"); Assert.IsNotNull(injectedSerializer); - Assert.IsInstanceOfType(injectedSerializer); + _ = Assert.IsInstanceOfType(injectedSerializer); Assert.AreEqual("obswebsocket.json", injectedSerializer.ProtocolSubProtocol); } @@ -111,7 +111,7 @@ public void AddObsWebSocketClient_JsonFormatConfigured_ResolvesJsonSerializer() { // Arrange ServiceCollection services = CreateServiceCollectionWithLogging(); - services.AddObsWebSocketClient(options => options.Format = SerializationFormat.Json); // Explicitly configure JSON + _ = services.AddObsWebSocketClient(options => options.Format = SerializationFormat.Json); // Explicitly configure JSON ServiceProvider provider = services.BuildServiceProvider(); // Act @@ -121,12 +121,12 @@ public void AddObsWebSocketClient_JsonFormatConfigured_ResolvesJsonSerializer() // Assert Assert.IsNotNull(resolvedSerializer); - Assert.IsInstanceOfType(resolvedSerializer); + _ = Assert.IsInstanceOfType(resolvedSerializer); Assert.IsNotNull(resolvedClient); IWebSocketMessageSerializer? injectedSerializer = TestUtils.GetPrivateField(resolvedClient, "_serializer"); Assert.IsNotNull(injectedSerializer); - Assert.IsInstanceOfType(injectedSerializer); + _ = Assert.IsInstanceOfType(injectedSerializer); Assert.AreEqual("obswebsocket.json", injectedSerializer.ProtocolSubProtocol); } @@ -138,7 +138,7 @@ public void AddObsWebSocketClient_MsgPackFormatConfigured_ResolvesMsgPackSeriali { // Arrange ServiceCollection services = CreateServiceCollectionWithLogging(); - services.AddObsWebSocketClient(options => options.Format = SerializationFormat.MsgPack); // Configure MsgPack + _ = services.AddObsWebSocketClient(options => options.Format = SerializationFormat.MsgPack); // Configure MsgPack ServiceProvider provider = services.BuildServiceProvider(); // Act @@ -148,12 +148,12 @@ public void AddObsWebSocketClient_MsgPackFormatConfigured_ResolvesMsgPackSeriali // Assert Assert.IsNotNull(resolvedSerializer); - Assert.IsInstanceOfType(resolvedSerializer); + _ = Assert.IsInstanceOfType(resolvedSerializer); Assert.IsNotNull(resolvedClient); IWebSocketMessageSerializer? injectedSerializer = TestUtils.GetPrivateField(resolvedClient, "_serializer"); Assert.IsNotNull(injectedSerializer); - Assert.IsInstanceOfType(injectedSerializer); + _ = Assert.IsInstanceOfType(injectedSerializer); Assert.AreEqual("obswebsocket.msgpack", injectedSerializer.ProtocolSubProtocol); } @@ -179,7 +179,7 @@ public void AddObsWebSocketClient_WithConfiguration_SetsOptions() // Act // Configure all options via the action - services.AddObsWebSocketClient(options => + _ = services.AddObsWebSocketClient(options => { options.ServerUri = testUri; options.Password = testPassword; @@ -225,7 +225,7 @@ public void AddObsWebSocketClient_WithoutConfiguration_UsesDefaults() ServiceCollection services = CreateServiceCollectionWithLogging(); // Act - services.AddObsWebSocketClient(); // Call without configuration action + _ = services.AddObsWebSocketClient(); // Call without configuration action ServiceProvider provider = services.BuildServiceProvider(); IOptions? resolvedOptions = provider.GetService< IOptions @@ -263,7 +263,7 @@ public async Task ConnectAsync_WithOptions_RequiresServerUri() // Arrange ServiceCollection services = CreateServiceCollectionWithLogging(); // Configure *without* setting ServerUri - services.AddObsWebSocketClient(opts => + _ = services.AddObsWebSocketClient(opts => { opts.Password = "abc"; }); @@ -272,10 +272,11 @@ public async Task ConnectAsync_WithOptions_RequiresServerUri() // Act & Assert // Expect ArgumentNullException when ConnectAsync is called without ServerUri - ArgumentNullException ex = await Assert.ThrowsExceptionAsync(() => + ArgumentNullException ex = await Assert.ThrowsExactlyAsync(() => client.ConnectAsync() ); // Verify the exception parameter name points to the missing option Assert.AreEqual("ServerUri", ex.ParamName); } } + diff --git a/ObsWebSocket.Tests/SerializerBehaviorTests.cs b/ObsWebSocket.Tests/SerializerBehaviorTests.cs new file mode 100644 index 0000000..3ae9432 --- /dev/null +++ b/ObsWebSocket.Tests/SerializerBehaviorTests.cs @@ -0,0 +1,737 @@ +using System.Buffers; +using System.Reflection; +using System.Text.Json; +using MessagePack; +using Microsoft.Extensions.Logging.Abstractions; +using ObsWebSocket.Core; +using ObsWebSocket.Core.Protocol; +using ObsWebSocket.Core.Protocol.Events; +using ObsWebSocket.Core.Protocol.Generated; +using ObsWebSocket.Core.Protocol.Requests; +using ObsWebSocket.Core.Protocol.Responses; +using ObsWebSocket.Core.Serialization; + +namespace ObsWebSocket.Tests; + +[TestClass] +public class SerializerBehaviorTests +{ + private static JsonMessageSerializer CreateJsonSerializer() => + new(NullLogger.Instance); + + private static MsgPackMessageSerializer CreateMsgPackSerializer() => + new(NullLogger.Instance); + + [TestMethod] + public void JsonSerializer_DeserializePayload_SceneStubExtensionData_IsAvailable() + { + JsonElement payload = JsonDocument + .Parse( + """ + { + "scenes": [ + { + "sceneIndex": 0, + "sceneName": "Scene A", + "sceneUuid": "uuid-a", + "extraField": { + "nestedName": "Nested Value", + "enabled": true, + "numbers": [1, 2, 3] + }, + "extraArray": [ + { "id": "a", "value": 10 }, + { "id": "b", "value": 20 } + ] + } + ] + } + """ + ) + .RootElement.Clone(); + + SceneListChangedPayload? result = CreateJsonSerializer().DeserializePayload( + payload + ); + + Assert.IsNotNull(result); + Assert.IsNotNull(result.Scenes); + Assert.AreEqual(1, result.Scenes.Count); + Dictionary? extensionData = result.Scenes[0].ExtensionData; + Assert.IsNotNull(extensionData); + Assert.IsTrue(extensionData.ContainsKey("extraField")); + Assert.IsTrue(extensionData.ContainsKey("extraArray")); + + JsonElement extraField = extensionData["extraField"]; + Assert.AreEqual(JsonValueKind.Object, extraField.ValueKind); + Assert.AreEqual("Nested Value", extraField.GetProperty("nestedName").GetString()); + Assert.IsTrue(extraField.GetProperty("enabled").GetBoolean()); + + JsonElement numbers = extraField.GetProperty("numbers"); + Assert.AreEqual(JsonValueKind.Array, numbers.ValueKind); + Assert.AreEqual(3, numbers.GetArrayLength()); + Assert.AreEqual(1, numbers[0].GetInt32()); + Assert.AreEqual(2, numbers[1].GetInt32()); + Assert.AreEqual(3, numbers[2].GetInt32()); + + JsonElement extraArray = extensionData["extraArray"]; + Assert.AreEqual(JsonValueKind.Array, extraArray.ValueKind); + Assert.AreEqual(2, extraArray.GetArrayLength()); + Assert.AreEqual("a", extraArray[0].GetProperty("id").GetString()); + Assert.AreEqual(10, extraArray[0].GetProperty("value").GetInt32()); + Assert.AreEqual("b", extraArray[1].GetProperty("id").GetString()); + Assert.AreEqual(20, extraArray[1].GetProperty("value").GetInt32()); + } + + [TestMethod] + public void MsgPackSerializer_DeserializePayload_WithComplexSceneStubBytes_DeserializesValues() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + byte[] payloadBytes = BuildSceneListChangedPayloadBytes(); + + SceneListChangedPayload? payload = serializer.DeserializePayload( + new ReadOnlyMemory(payloadBytes) + ); + + Assert.IsNotNull(payload); + List? scenes = payload.Scenes; + Assert.IsNotNull(scenes); + Assert.AreEqual(1, scenes.Count); + Assert.AreEqual(1, scenes[0].SceneIndex); + Assert.AreEqual("IntegrationScene", scenes[0].SceneName); + Assert.AreEqual("scene-uuid-1", scenes[0].SceneUuid); + Dictionary? extensionData = scenes[0].ExtensionData; + Assert.IsNotNull(extensionData); + Assert.AreEqual( + "extension-data-like-field", + extensionData["extraTag"].GetString() + ); + } + + [TestMethod] + public void MsgPackSerializer_DeserializePayload_WithComplexFilterBytes_DeserializesValues() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + byte[] payloadBytes = BuildSourceFilterListPayloadBytes(); + + GetSourceFilterListResponseData? payload = + serializer.DeserializePayload( + new ReadOnlyMemory(payloadBytes) + ); + + Assert.IsNotNull(payload); + List? filters = payload.Filters; + Assert.IsNotNull(filters); + Assert.AreEqual(1, filters.Count); + Assert.AreEqual("Color Correction", filters[0].FilterName); + Assert.AreEqual("color_filter_v2", filters[0].FilterKind); + Assert.AreEqual(0, filters[0].FilterIndex); + Assert.IsTrue(filters[0].FilterEnabled ?? false); + Assert.IsTrue(filters[0].FilterSettings.HasValue); + JsonElement filterSettings = filters[0].FilterSettings.GetValueOrDefault(); + Assert.AreEqual( + 0.8d, + filterSettings.GetProperty("opacity").GetDouble(), + 0.0001d + ); + Assert.AreEqual( + 1.2d, + filterSettings.GetProperty("gamma").GetDouble(), + 0.0001d + ); + Dictionary? extensionData = filters[0].ExtensionData; + Assert.IsNotNull(extensionData); + Assert.AreEqual( + "present", + extensionData["customExtensionField"].GetString() + ); + JsonElement listExtension = extensionData["listExtension"]; + Assert.AreEqual(JsonValueKind.Array, listExtension.ValueKind); + Assert.AreEqual(2, listExtension.GetArrayLength()); + Assert.AreEqual("a", listExtension[0].GetString()); + Assert.AreEqual("b", listExtension[1].GetString()); + } + + [TestMethod] + public void MsgPackSerializer_DeserializeValuePayload_WithIntBytes_DeserializesValue() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + byte[] bytes = MessagePack.MessagePackSerializer.Serialize(42); + int? payload = serializer.DeserializeValuePayload(new ReadOnlyMemory(bytes)); + + Assert.IsTrue(payload.HasValue); + Assert.AreEqual(42, payload.Value); + } + + [TestMethod] + public async Task JsonSerializer_SerializeAsync_RequestPayloadWithTypedRequestData_ContainsExpectedShape() + { + JsonMessageSerializer serializer = CreateJsonSerializer(); + JsonElement requestData = JsonDocument + .Parse( + """ + { + "filterName": "Color Correction", + "filterSettings": { + "opacity": 0.75, + "gamma": 1.20, + "advanced": { "lift": 0.1 } + }, + "overlay": true + } + """ + ) + .RootElement.Clone(); + + OutgoingMessage message = new( + WebSocketOpCode.Request, + new RequestPayload("SetSourceFilterSettings", "req-99", requestData) + ); + + byte[] bytes = await serializer.SerializeAsync(message); + using JsonDocument doc = JsonDocument.Parse(bytes); + JsonElement root = doc.RootElement; + Assert.AreEqual((int)WebSocketOpCode.Request, root.GetProperty("op").GetInt32()); + JsonElement d = root.GetProperty("d"); + Assert.AreEqual("SetSourceFilterSettings", d.GetProperty("requestType").GetString()); + Assert.AreEqual("req-99", d.GetProperty("requestId").GetString()); + JsonElement payload = d.GetProperty("requestData"); + Assert.AreEqual("Color Correction", payload.GetProperty("filterName").GetString()); + Assert.IsTrue(payload.GetProperty("overlay").GetBoolean()); + Assert.AreEqual( + 0.75d, + payload.GetProperty("filterSettings").GetProperty("opacity").GetDouble(), + 0.0001d + ); + } + + [TestMethod] + public void JsonSerializer_DeserializePayload_NestedTypeRequestData_DeserializesModifiers() + { + JsonMessageSerializer serializer = CreateJsonSerializer(); + JsonElement payload = JsonDocument + .Parse( + """ + { + "keyId": "OBS_KEY_A", + "keyModifiers": { + "alt": true, + "command": false, + "control": true, + "shift": false + } + } + """ + ) + .RootElement.Clone(); + + TriggerHotkeyByKeySequenceRequestData? data = + serializer.DeserializePayload(payload); + + Assert.IsNotNull(data); + Assert.AreEqual("OBS_KEY_A", data.KeyId); + Assert.IsNotNull(data.KeyModifiers); + Assert.IsTrue(data.KeyModifiers.Alt); + Assert.IsFalse(data.KeyModifiers.Command); + Assert.IsTrue(data.KeyModifiers.Control); + Assert.IsFalse(data.KeyModifiers.Shift); + } + + [TestMethod] + public void JsonSerializer_DeserializePayload_InvalidGeneratedShape_ReturnsDefault() + { + JsonMessageSerializer serializer = CreateJsonSerializer(); + JsonElement payload = JsonDocument + .Parse( + """ + { + "sceneName": 12345 + } + """ + ) + .RootElement.Clone(); + + CreateSceneRequestData? data = serializer.DeserializePayload(payload); + Assert.IsNull(data); + } + + [TestMethod] + public async Task MsgPackSerializer_DeserializeAsync_WithEmptyStream_ReturnsNull() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + await using MemoryStream stream = new([]); + object? envelope = await serializer.DeserializeAsync(stream); + + Assert.IsNull(envelope); + } + + [TestMethod] + public async Task MsgPackSerializer_DeserializeAsync_IncomingMapPayload_CapturesRawDBytes() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + byte[] bytes = BuildIncomingHelloEnvelopeBytes(); + await using MemoryStream stream = new(bytes); + + object? envelope = await serializer.DeserializeAsync(stream); + + _ = Assert.IsInstanceOfType>>(envelope); + IncomingMessage> incoming = (IncomingMessage>)envelope; + Assert.AreEqual(WebSocketOpCode.Hello, incoming.Op); + Assert.IsTrue(incoming.D.Length > 0); + + HelloPayload? hello = serializer.DeserializePayload(incoming.D); + Assert.IsNotNull(hello); + Assert.AreEqual("5.0.0", hello.ObsWebSocketVersion); + Assert.AreEqual(1, hello.RpcVersion); + } + + [TestMethod] + public async Task MsgPackSerializer_DeserializeAsync_WithUnreadableStream_ThrowsArgumentException() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + await using UnreadableMemoryStream stream = new([]); + + try + { + _ = await serializer.DeserializeAsync(stream); + Assert.Fail("Expected ArgumentException for unreadable stream."); + } + catch (ArgumentException) + { + // Expected. + } + } + + [TestMethod] + public async Task MsgPackSerializer_SerializeAsync_KnownGeneratedPayload_ReturnsBytes() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + OutgoingMessage message = new( + WebSocketOpCode.Request, + new RequestPayload("GetVersion", "req-1", null) + ); + + byte[] bytes = await serializer.SerializeAsync(message); + Assert.IsTrue(bytes.Length > 0); + } + + [TestMethod] + public async Task MsgPackSerializer_SerializeAsync_WithJsonElementRequestData_RoundTripsThroughDeserializer() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + JsonElement settings = JsonDocument + .Parse( + """ + { + "sceneName": "Scene A", + "filterSettings": { + "opacity": 0.33 + } + } + """ + ) + .RootElement.Clone(); + + OutgoingMessage message = new( + WebSocketOpCode.Request, + new RequestPayload("SetSourceFilterSettings", "req-55", settings) + ); + + byte[] bytes = await serializer.SerializeAsync(message); + byte[] dRaw = ExtractDFieldRawBytes(bytes); + RequestPayload? requestPayload = serializer.DeserializePayload( + new ReadOnlyMemory(dRaw) + ); + Assert.IsNotNull(requestPayload); + Assert.AreEqual("SetSourceFilterSettings", requestPayload.RequestType); + Assert.AreEqual("req-55", requestPayload.RequestId); + Assert.IsTrue(requestPayload.RequestData.HasValue); + Assert.AreEqual( + "Scene A", + requestPayload.RequestData.Value.GetProperty("sceneName").GetString() + ); + Assert.AreEqual( + 0.33d, + requestPayload + .RequestData.Value.GetProperty("filterSettings") + .GetProperty("opacity") + .GetDouble(), + 0.0001d + ); + } + + [TestMethod] + public void MsgPackSerializer_DeserializePayload_NestedType_FromBytes() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + byte[] bytes = BuildTriggerHotkeyNestedPayloadBytes(); + + TriggerHotkeyByKeySequenceRequestData? payload = + serializer.DeserializePayload( + new ReadOnlyMemory(bytes) + ); + + Assert.IsNotNull(payload); + Assert.AreEqual("OBS_KEY_B", payload.KeyId); + Assert.IsNotNull(payload.KeyModifiers); + Assert.IsTrue(payload.KeyModifiers.Alt); + Assert.IsTrue(payload.KeyModifiers.Control); + Assert.IsFalse(payload.KeyModifiers.Command); + Assert.IsFalse(payload.KeyModifiers.Shift); + } + + [TestMethod] + public void MsgPackSerializer_DeserializePayload_SceneItemList_WithTransformAndExtensionData() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + byte[] bytes = BuildSceneItemListPayloadBytes(); + + GetSceneItemListResponseData? payload = + serializer.DeserializePayload(new ReadOnlyMemory(bytes)); + + Assert.IsNotNull(payload); + List? sceneItems = payload.SceneItems; + Assert.IsNotNull(sceneItems); + Assert.AreEqual(1, sceneItems.Count); + Assert.AreEqual(42, sceneItems[0].SceneItemId); + Assert.AreEqual("Camera", sceneItems[0].SourceName); + Core.Protocol.Common.SceneItemTransformStub? transform = sceneItems[0].SceneItemTransform; + Assert.IsNotNull(transform); + Assert.IsTrue(transform.Width.HasValue); + Assert.AreEqual(1920d, transform.Width.Value, 0.001d); + Dictionary? extensionData = sceneItems[0].ExtensionData; + Assert.IsNotNull(extensionData); + Assert.AreEqual("group-A", extensionData["customGroup"].GetString()); + } + + [TestMethod] + public void MsgPackSerializer_DeserializePayload_InvalidGeneratedShape_ReturnsDefault() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + byte[] bytes = BuildInvalidFilterListPayloadBytes(); + + GetSourceFilterListResponseData? payload = + serializer.DeserializePayload(new ReadOnlyMemory(bytes)); + + Assert.IsNull(payload); + } + + [TestMethod] + public void MsgPackSerializer_SerializeThenDeserialize_FilterPayload_RoundTripsWithValues() + { + MsgPackMessageSerializer serializer = CreateMsgPackSerializer(); + GetSourceFilterListResponseData payload = new( + [ + new Core.Protocol.Common.FilterStub + { + FilterName = "Color Correction", + FilterKind = "color_filter_v2", + FilterIndex = 0, + FilterEnabled = true, + }, + new Core.Protocol.Common.FilterStub + { + FilterName = "Limiter", + FilterKind = "limiter_filter_v2", + FilterIndex = 1, + FilterEnabled = false, + }, + ] + ); + + byte[] bytes = MessagePack.MessagePackSerializer.Serialize(payload); + GetSourceFilterListResponseData? roundTrip = serializer.DeserializePayload< + GetSourceFilterListResponseData + >(new ReadOnlyMemory(bytes)); + + Assert.IsNotNull(roundTrip); + Assert.IsNotNull(roundTrip.Filters); + Assert.AreEqual(2, roundTrip.Filters.Count); + + Assert.AreEqual("Color Correction", roundTrip.Filters[0].FilterName); + Assert.AreEqual("color_filter_v2", roundTrip.Filters[0].FilterKind); + Assert.AreEqual(0, roundTrip.Filters[0].FilterIndex); + Assert.IsTrue(roundTrip.Filters[0].FilterEnabled); + Assert.IsFalse(roundTrip.Filters[0].FilterSettings.HasValue); + + Assert.AreEqual("Limiter", roundTrip.Filters[1].FilterName); + Assert.AreEqual("limiter_filter_v2", roundTrip.Filters[1].FilterKind); + Assert.AreEqual(1, roundTrip.Filters[1].FilterIndex); + Assert.IsFalse(roundTrip.Filters[1].FilterEnabled ?? true); + Assert.IsFalse(roundTrip.Filters[1].FilterSettings.HasValue); + } + + [TestMethod] + public void MsgPackResolver_CoversGeneratedAndCoreProtocolTypes() + { + Type[] allTypes = typeof(ObsWebSocketClient).Assembly.GetTypes(); + List requiredTypes = []; + + requiredTypes.AddRange( + allTypes.Where(static t => + t is { IsClass: true, IsAbstract: false } + && t.Namespace == "ObsWebSocket.Core.Protocol.Requests" + && t.Name.EndsWith("RequestData", StringComparison.Ordinal) + ) + ); + + requiredTypes.AddRange( + allTypes.Where(static t => + t is { IsClass: true, IsAbstract: false } + && t.Namespace == "ObsWebSocket.Core.Protocol.Responses" + && t.Name.EndsWith("ResponseData", StringComparison.Ordinal) + ) + ); + + requiredTypes.AddRange( + allTypes.Where(static t => + t is { IsClass: true, IsAbstract: false } + && t.Namespace == "ObsWebSocket.Core.Protocol.Events" + && t.Name.EndsWith("Payload", StringComparison.Ordinal) + ) + ); + + requiredTypes.AddRange( + allTypes.Where(static t => + t is { IsClass: true, IsAbstract: false } + && t.Namespace == "ObsWebSocket.Core.Protocol.Common.NestedTypes" + ) + ); + + requiredTypes.Add( + typeof(HelloPayload) + ); + requiredTypes.Add( + typeof(AuthenticationData) + ); + requiredTypes.Add( + typeof(IdentifyPayload) + ); + requiredTypes.Add( + typeof(IdentifiedPayload) + ); + requiredTypes.Add( + typeof(ReidentifyPayload) + ); + requiredTypes.Add( + typeof(RequestPayload) + ); + requiredTypes.Add( + typeof(RequestBatchPayload) + ); + requiredTypes.Add(typeof(ObsWebSocket.Core.Protocol.RequestStatus)); + + List missing = []; + foreach (Type type in requiredTypes.Distinct()) + { + if (!HasFormatter(ObsWebSocketMsgPackResolver.Instance, type)) + { + missing.Add(type.FullName ?? type.Name); + } + } + + if (missing.Count > 0) + { + Assert.Fail( + $"ObsWebSocketMsgPackResolver is missing formatter(s): {string.Join(", ", missing.OrderBy(static s => s, StringComparer.Ordinal))}" + ); + } + } + + private static byte[] BuildSceneListChangedPayloadBytes() + { + ArrayBufferWriter buffer = new(); + MessagePackWriter writer = new(buffer); + + writer.WriteMapHeader(1); + writer.Write("scenes"); + writer.WriteArrayHeader(1); + writer.WriteMapHeader(4); + writer.Write("sceneIndex"); + writer.Write(1); + writer.Write("sceneName"); + writer.Write("IntegrationScene"); + writer.Write("sceneUuid"); + writer.Write("scene-uuid-1"); + writer.Write("extraTag"); + writer.Write("extension-data-like-field"); + writer.Flush(); + + return [.. buffer.WrittenSpan]; + } + + private static byte[] ExtractDFieldRawBytes(byte[] messageBytes) + { + MessagePackReader reader = new(new ReadOnlySequence(messageBytes)); + int count = reader.ReadMapHeader(); + for (int i = 0; i < count; i++) + { + string key = reader.ReadString()!; + if (key == "d") + { + return ReadRawValue(ref reader); + } + + reader.Skip(); + } + + Assert.Fail("MessagePack payload did not contain 'd' field."); + return []; + } + + private static byte[] ReadRawValue(ref MessagePackReader reader) + { + SequencePosition start = reader.Position; + MessagePackReader clone = reader; + clone.Skip(); + SequencePosition end = clone.Position; + ReadOnlySequence sequence = reader.Sequence.Slice(start, end); + byte[] raw = new byte[checked((int)sequence.Length)]; + sequence.CopyTo(raw); + reader = clone; + return raw; + } + + private static byte[] BuildTriggerHotkeyNestedPayloadBytes() + { + ArrayBufferWriter buffer = new(); + MessagePackWriter writer = new(buffer); + + writer.WriteMapHeader(2); + writer.Write("keyId"); + writer.Write("OBS_KEY_B"); + writer.Write("keyModifiers"); + writer.WriteMapHeader(4); + writer.Write("alt"); + writer.Write(true); + writer.Write("command"); + writer.Write(false); + writer.Write("control"); + writer.Write(true); + writer.Write("shift"); + writer.Write(false); + writer.Flush(); + + return [.. buffer.WrittenSpan]; + } + + private static byte[] BuildSceneItemListPayloadBytes() + { + ArrayBufferWriter buffer = new(); + MessagePackWriter writer = new(buffer); + + writer.WriteMapHeader(1); + writer.Write("sceneItems"); + writer.WriteArrayHeader(1); + writer.WriteMapHeader(6); + writer.Write("sceneItemId"); + writer.Write(42); + writer.Write("sourceName"); + writer.Write("Camera"); + writer.Write("sceneItemEnabled"); + writer.Write(true); + writer.Write("sceneItemTransform"); + writer.WriteMapHeader(2); + writer.Write("width"); + writer.Write(1920d); + writer.Write("height"); + writer.Write(1080d); + writer.Write("customGroup"); + writer.Write("group-A"); + writer.Write("customArray"); + writer.WriteArrayHeader(2); + writer.Write("x"); + writer.Write("y"); + writer.Flush(); + + return [.. buffer.WrittenSpan]; + } + + private static byte[] BuildInvalidFilterListPayloadBytes() + { + ArrayBufferWriter buffer = new(); + MessagePackWriter writer = new(buffer); + + writer.WriteMapHeader(1); + writer.Write("filters"); + writer.WriteArrayHeader(1); + writer.WriteMapHeader(4); + writer.Write("filterName"); + writer.Write("Broken Filter"); + writer.Write("filterKind"); + writer.Write("color_filter_v2"); + writer.Write("filterIndex"); + writer.Write("not-a-number"); + writer.Write("filterEnabled"); + writer.Write(true); + writer.Flush(); + + return [.. buffer.WrittenSpan]; + } + + private static byte[] BuildIncomingHelloEnvelopeBytes() + { + ArrayBufferWriter buffer = new(); + MessagePackWriter writer = new(buffer); + + writer.WriteMapHeader(2); + writer.Write("op"); + writer.Write((int)WebSocketOpCode.Hello); + writer.Write("d"); + writer.WriteMapHeader(2); + writer.Write("obsWebSocketVersion"); + writer.Write("5.0.0"); + writer.Write("rpcVersion"); + writer.Write(1); + writer.Flush(); + + return [.. buffer.WrittenSpan]; + } + + private static byte[] BuildSourceFilterListPayloadBytes() + { + ArrayBufferWriter buffer = new(); + MessagePackWriter writer = new(buffer); + + writer.WriteMapHeader(1); + writer.Write("filters"); + writer.WriteArrayHeader(1); + writer.WriteMapHeader(7); + writer.Write("filterName"); + writer.Write("Color Correction"); + writer.Write("filterKind"); + writer.Write("color_filter_v2"); + writer.Write("filterIndex"); + writer.Write(0); + writer.Write("filterEnabled"); + writer.Write(true); + writer.Write("filterSettings"); + writer.WriteMapHeader(2); + writer.Write("opacity"); + writer.Write(0.8); + writer.Write("gamma"); + writer.Write(1.2); + writer.Write("customExtensionField"); + writer.Write("present"); + writer.Write("listExtension"); + writer.WriteArrayHeader(2); + writer.Write("a"); + writer.Write("b"); + writer.Flush(); + + return [.. buffer.WrittenSpan]; + } + + private sealed class UnreadableMemoryStream(byte[] buffer) : MemoryStream(buffer) + { + public override bool CanRead => false; + } + + private static bool HasFormatter(IFormatterResolver resolver, Type targetType) + { + MethodInfo? method = typeof(IFormatterResolver).GetMethod(nameof(IFormatterResolver.GetFormatter)); + Assert.IsNotNull(method, "Could not locate IFormatterResolver.GetFormatter."); + object? formatter = method.MakeGenericMethod(targetType).Invoke(resolver, null); + return formatter is not null; + } +} diff --git a/ObsWebSocket.Tests/TestUtils.cs b/ObsWebSocket.Tests/TestUtils.cs index bfa9a12..3569056 100644 --- a/ObsWebSocket.Tests/TestUtils.cs +++ b/ObsWebSocket.Tests/TestUtils.cs @@ -56,7 +56,7 @@ Mock mockFactory { ServiceCollection services = new(); - services.AddLogging(builder => builder.AddConsole().SetMinimumLevel(LogLevel.Trace)); + _ = services.AddLogging(builder => builder.AddConsole().SetMinimumLevel(LogLevel.Trace)); // --- Create Mocks (Strict) --- Mock mockConnection = new(MockBehavior.Strict); @@ -67,21 +67,21 @@ Mock mockFactory // --- Default Mock Setups (Strict Behavior Compliance) --- // IWebSocketConnectionFactory - mockConnectionFactory.Setup(f => f.CreateConnection()).Returns(mockConnection.Object); + _ = mockConnectionFactory.Setup(f => f.CreateConnection()).Returns(mockConnection.Object); // IWebSocketConnection (Defaults for basic operation and cleanup) - mockConnection.SetupGet(c => c.State).Returns(WebSocketState.None); - mockConnection.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); - mockConnection.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); - mockConnection.SetupGet(c => c.CloseStatus).Returns((WebSocketCloseStatus?)null); - mockConnection.SetupGet(c => c.CloseStatusDescription).Returns((string?)null); - mockConnection + _ = mockConnection.SetupGet(c => c.State).Returns(WebSocketState.None); + _ = mockConnection.SetupGet(c => c.Options).Returns(new ClientWebSocket().Options); + _ = mockConnection.SetupGet(c => c.SubProtocol).Returns("obswebsocket.json"); + _ = mockConnection.SetupGet(c => c.CloseStatus).Returns((WebSocketCloseStatus?)null); + _ = mockConnection.SetupGet(c => c.CloseStatusDescription).Returns((string?)null); + _ = mockConnection .Setup(c => c.ConnectAsync(It.IsAny(), It.IsAny())) .Returns(Task.CompletedTask); - mockConnection + _ = mockConnection .Setup(c => c.ReceiveAsync(It.IsAny>(), It.IsAny())) .ReturnsAsync(new ValueWebSocketReceiveResult(0, WebSocketMessageType.Close, true)); - mockConnection + _ = mockConnection .Setup(c => c.SendAsync( It.IsAny>(), @@ -91,7 +91,7 @@ Mock mockFactory ) ) .Returns(ValueTask.CompletedTask); - mockConnection + _ = mockConnection .Setup(c => c.CloseOutputAsync( It.IsAny(), @@ -100,7 +100,7 @@ Mock mockFactory ) ) .Returns(Task.CompletedTask); - mockConnection + _ = mockConnection .Setup(c => c.CloseAsync( It.IsAny(), @@ -109,15 +109,15 @@ Mock mockFactory ) ) .Returns(Task.CompletedTask); - mockConnection.Setup(c => c.Abort()); - mockConnection.Setup(c => c.Dispose()); + _ = mockConnection.Setup(c => c.Abort()); + _ = mockConnection.Setup(c => c.Dispose()); // IWebSocketMessageSerializer (Defaults) - mockSerializer.SetupGet(s => s.ProtocolSubProtocol).Returns("obswebsocket.json"); - mockSerializer + _ = mockSerializer.SetupGet(s => s.ProtocolSubProtocol).Returns("obswebsocket.json"); + _ = mockSerializer .Setup(s => s.DeserializeAsync(It.IsAny(), It.IsAny())) .ReturnsAsync((object?)null); - mockSerializer + _ = mockSerializer .Setup(s => s.SerializeAsync( It.IsAny>(), @@ -125,7 +125,7 @@ Mock mockFactory ) ) .ReturnsAsync([]); - mockSerializer + _ = mockSerializer .Setup(s => s.SerializeAsync( It.IsAny>(), @@ -133,7 +133,7 @@ Mock mockFactory ) ) .ReturnsAsync([]); - mockSerializer + _ = mockSerializer .Setup(s => s.SerializeAsync( It.IsAny>(), @@ -144,7 +144,7 @@ Mock mockFactory (OutgoingMessage msg, CancellationToken _) => Encoding.UTF8.GetBytes(JsonSerializer.Serialize(msg, s_jsonSerializerOptions)) ); - mockSerializer + _ = mockSerializer .Setup(s => s.SerializeAsync( It.IsAny>(), @@ -157,10 +157,10 @@ Mock mockFactory ); // --- DI Registration --- - services.AddOptions(); - services.AddSingleton(mockSerializer.Object); - services.AddSingleton(mockConnectionFactory.Object); - services.Configure(opts => + _ = services.AddOptions(); + _ = services.AddSingleton(mockSerializer.Object); + _ = services.AddSingleton(mockConnectionFactory.Object); + _ = services.Configure(opts => { opts.ServerUri = new Uri("ws://testhost:4455"); opts.AutoReconnectEnabled = false; @@ -169,7 +169,7 @@ Mock mockFactory opts.Format = SerializationFormat.Json; configureOptions?.Invoke(opts); }); - services.AddSingleton(); + _ = services.AddSingleton(); // --- Build and Return --- ServiceProvider provider = services.BuildServiceProvider(); @@ -213,10 +213,10 @@ Mock mockConnection SetPrivateProperty(client, "IsConnected", true); SetPrivateField(client, "_clientLifetimeCts", new CancellationTokenSource()); - mockConnection.SetupGet(c => c.State).Returns(WebSocketState.Open); + _ = mockConnection.SetupGet(c => c.State).Returns(WebSocketState.Open); TaskCompletionSource blockedReceiveTcs = new(); - mockConnection + _ = mockConnection .Setup(c => c.ReceiveAsync(It.IsAny>(), It.IsAny())) .Returns(new ValueTask(blockedReceiveTcs.Task)); @@ -238,7 +238,7 @@ object messageObject ) ?? throw new MissingMethodException("ObsWebSocketClient", "ProcessIncomingMessage"); try { - method.Invoke(client, [messageObject]); + _ = method.Invoke(client, [messageObject]); } catch (TargetInvocationException ex) { diff --git a/ObsWebSocket.sln b/ObsWebSocket.sln index c51f5d5..597d0b6 100644 --- a/ObsWebSocket.sln +++ b/ObsWebSocket.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 17.13.35931.197 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObsWebSocket.Core", "ObsWebSocket.Core\ObsWebSocket.Core.csproj", "{826830C5-648F-4279-98FF-C1358E8E89EA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObsWebSocket.SourceGenerators", "ObsWebSocket.SourceGenerators\ObsWebSocket.SourceGenerators.csproj", "{A1CC6A2A-CB70-41D2-A9B5-37D5D6F35F51}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObsWebSocket.Tests", "ObsWebSocket.Tests\ObsWebSocket.Tests.csproj", "{5AA95762-8FC0-4F92-996D-7EDFEE8D2592}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObsWebSocket.Example", "ObsWebSocket.Example\ObsWebSocket.Example.csproj", "{8B73365F-A31D-4F3D-5139-545126A1720D}" @@ -20,25 +18,49 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {826830C5-648F-4279-98FF-C1358E8E89EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {826830C5-648F-4279-98FF-C1358E8E89EA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {826830C5-648F-4279-98FF-C1358E8E89EA}.Debug|x64.ActiveCfg = Debug|Any CPU + {826830C5-648F-4279-98FF-C1358E8E89EA}.Debug|x64.Build.0 = Debug|Any CPU + {826830C5-648F-4279-98FF-C1358E8E89EA}.Debug|x86.ActiveCfg = Debug|Any CPU + {826830C5-648F-4279-98FF-C1358E8E89EA}.Debug|x86.Build.0 = Debug|Any CPU {826830C5-648F-4279-98FF-C1358E8E89EA}.Release|Any CPU.ActiveCfg = Release|Any CPU {826830C5-648F-4279-98FF-C1358E8E89EA}.Release|Any CPU.Build.0 = Release|Any CPU - {A1CC6A2A-CB70-41D2-A9B5-37D5D6F35F51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A1CC6A2A-CB70-41D2-A9B5-37D5D6F35F51}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A1CC6A2A-CB70-41D2-A9B5-37D5D6F35F51}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A1CC6A2A-CB70-41D2-A9B5-37D5D6F35F51}.Release|Any CPU.Build.0 = Release|Any CPU + {826830C5-648F-4279-98FF-C1358E8E89EA}.Release|x64.ActiveCfg = Release|Any CPU + {826830C5-648F-4279-98FF-C1358E8E89EA}.Release|x64.Build.0 = Release|Any CPU + {826830C5-648F-4279-98FF-C1358E8E89EA}.Release|x86.ActiveCfg = Release|Any CPU + {826830C5-648F-4279-98FF-C1358E8E89EA}.Release|x86.Build.0 = Release|Any CPU {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Debug|x64.ActiveCfg = Debug|Any CPU + {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Debug|x64.Build.0 = Debug|Any CPU + {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Debug|x86.ActiveCfg = Debug|Any CPU + {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Debug|x86.Build.0 = Debug|Any CPU {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Release|Any CPU.ActiveCfg = Release|Any CPU {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Release|Any CPU.Build.0 = Release|Any CPU + {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Release|x64.ActiveCfg = Release|Any CPU + {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Release|x64.Build.0 = Release|Any CPU + {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Release|x86.ActiveCfg = Release|Any CPU + {5AA95762-8FC0-4F92-996D-7EDFEE8D2592}.Release|x86.Build.0 = Release|Any CPU {8B73365F-A31D-4F3D-5139-545126A1720D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8B73365F-A31D-4F3D-5139-545126A1720D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B73365F-A31D-4F3D-5139-545126A1720D}.Debug|x64.ActiveCfg = Debug|Any CPU + {8B73365F-A31D-4F3D-5139-545126A1720D}.Debug|x64.Build.0 = Debug|Any CPU + {8B73365F-A31D-4F3D-5139-545126A1720D}.Debug|x86.ActiveCfg = Debug|Any CPU + {8B73365F-A31D-4F3D-5139-545126A1720D}.Debug|x86.Build.0 = Debug|Any CPU {8B73365F-A31D-4F3D-5139-545126A1720D}.Release|Any CPU.ActiveCfg = Release|Any CPU {8B73365F-A31D-4F3D-5139-545126A1720D}.Release|Any CPU.Build.0 = Release|Any CPU + {8B73365F-A31D-4F3D-5139-545126A1720D}.Release|x64.ActiveCfg = Release|Any CPU + {8B73365F-A31D-4F3D-5139-545126A1720D}.Release|x64.Build.0 = Release|Any CPU + {8B73365F-A31D-4F3D-5139-545126A1720D}.Release|x86.ActiveCfg = Release|Any CPU + {8B73365F-A31D-4F3D-5139-545126A1720D}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index 3a1f2c6..d74157a 100644 --- a/README.md +++ b/README.md @@ -1,335 +1,170 @@ -# ObsWebSocket.Core: Your Modern C# Bridge to OBS! 🚀🎬✨ +# ObsWebSocket.Core + +Modern .NET client for OBS Studio WebSocket v5, with generated protocol types and DI-first integration. [![Build Status](https://img.shields.io/github/actions/workflow/status/Agash/ObsWebSocket/build.yml?branch=master&style=flat-square&logo=github&logoColor=white)](https://github.com/Agash/ObsWebSocket/actions) [![NuGet Version](https://img.shields.io/nuget/v/ObsWebSocket.Core.svg?style=flat-square&logo=nuget&logoColor=white)](https://www.nuget.org/packages/ObsWebSocket.Core/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT) -Hey OBS Power Users, Stream Tool Crafters, and Automation Fans! 👋 - -Ready to take control of OBS Studio directly from your C#/.NET applications? Want to build custom stream dashboards, trigger actions based on game events, automate scene switching, or create unique chat interactions linked to OBS? You've come to the right place! 😎 - -**ObsWebSocket.Core** is a sleek, modern, and developer-friendly .NET 9 library built for interacting with the **OBS Studio WebSocket API v5**. Forget wrestling with raw WebSocket messages – this library provides a clean, asynchronous, and strongly-typed way to talk to OBS. - -Built with the latest C# 13/.NET 9 goodies, including source generators that build the API directly from the official `protocol.json`, ensuring you're always aligned with the latest OBS WebSocket features! 🔧 - -Perfect for: - -- Building custom remote controls or Stream Deck alternatives 🎛️ -- Automating scene changes based on external triggers (game events, chat commands) 🤖 -- Creating dynamic overlays that react to OBS events 📊 -- Developing sophisticated broadcasting tools and dashboards 📈 -- Integrating OBS control into larger .NET applications or services 🔗 -- Anything else your creative mind can dream up to enhance your stream! 🧠💡 - -## Features That Rock 🎸 +## Targets -- ✅ **Full OBS WebSocket v5 Support:** Auto-generated client methods, request/response types, and event arguments directly from the protocol spec. -- ⚡ **Modern Async Everywhere:** Built with `async/await`, `Task`, `ValueTask`, and `CancellationToken` for responsive applications. -- 🔧 **Easy DI Integration:** Simple setup in your .NET host with `AddObsWebSocketClient()`. -- ⚙️ **Flexible Configuration:** Use `IOptions` and `appsettings.json` for easy setup. -- ↔️ **JSON & MessagePack:** Choose between human-readable JSON (default) or efficient binary MessagePack serialization. -- 💪 **Connection Resilience:** Optional, configurable automatic reconnection keeps your connection stable. -- 🔒 **Strongly-Typed:** Compile-time safety and great IntelliSense thanks to generated DTOs and event args. -- 🔔 **Standard .NET Events:** Subscribe to OBS events using familiar `event EventHandler` patterns. -- ✨ **Convenience Helpers:** Includes extension methods for common tasks like switching scenes (with transitions & waiting), setting text source content, managing scene item visibility, checking if sources exist, setting multiple mutes at once, getting typed filter settings, waiting for specific event conditions, and more! _(New!)_ -- 🌐 **Cross-Platform:** Built on .NET 9. +- `net10.0` +- `net9.0` -## Version Alert! ⚠️ +## Install -> This library is exclusively for **OBS WebSocket API v5** (the version built into OBS Studio 28 and later). It **will not work** with the older v4.x plugin. Ensure `obs-websocket` is enabled in OBS (usually under `Tools -> WebSocket Server Settings`). +```bash +dotnet add package ObsWebSocket.Core +``` -## Get Started Fast 💨 +## What You Get -Using `ObsWebSocket.Core` with .NET's Generic Host and Dependency Injection is the smoothest path. +- Strongly typed request/response DTOs generated from OBS protocol +- Strongly typed OBS event args +- Async-first API (`Task`, `ValueTask`, cancellation support) +- DI helpers via `AddObsWebSocketClient()` +- Configurable JSON or MessagePack transport +- Reconnect and timeout options via `ObsWebSocketClientOptions` +- Convenience helpers for common scene/input/filter workflows -**1. Install the Package:** +## Important Caveats -```bash -dotnet add package ObsWebSocket.Core -``` +- This library is for **OBS WebSocket v5** only (OBS Studio 28+). +- Make sure OBS WebSocket server is enabled (`Tools -> WebSocket Server Settings`). +- If you use authentication, provide the correct password in options/config. -**2. Configure `appsettings.json`:** +## Quick Start (DI) -Add an `"Obs"` section to your `appsettings.json`: +`appsettings.json`: ```json { - "Logging": { - "LogLevel": { - "Default": "Information", - "ObsWebSocket.Core": "Information" // Use "Trace" for verbose library logs - } - }, - "Obs": { - // REQUIRED: Update with your OBS WebSocket server details - "ServerUri": "ws://localhost:4455", - // Optional: Add password if authentication is enabled in OBS - "Password": "YourSuperSecretPassword", - // Optional: Specify event subscriptions (defaults to 'All' non-high-volume). - // See ObsWebSocket.Core.Protocol.Generated.EventSubscription enum flags. - // Example: 13 (General | Scenes | Inputs -> 1 | 4 | 8 = 13) - "EventSubscriptions": null, - // Optional: Choose serialization format ('Json' or 'MsgPack') - "Format": "Json" - } + "Obs": { + "ServerUri": "ws://localhost:4455", + "Password": "", + "EventSubscriptions": null, + "Format": "Json" + } } ``` -**3. Register in `Program.cs`:** +`Program.cs`: ```csharp -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; using ObsWebSocket.Core; -using YourApplicationNamespace; // <-- Your namespace HostApplicationBuilder builder = Host.CreateApplicationBuilder(args); -// Standard logging setup (example) -builder.Logging.ClearProviders(); -builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging")); -builder.Logging.AddConsole(); - -// 1. Read OBS settings from the "Obs" section -builder.Services.Configure(builder.Configuration.GetSection("Obs")); +builder.Services.Configure( + builder.Configuration.GetSection("Obs")); -// 2. Add the OBS WebSocket client services builder.Services.AddObsWebSocketClient(); +builder.Services.AddHostedService(); -// 3. Add your application's service that will use the client -builder.Services.AddHostedService(); // <-- Your service - -using IHost host = builder.Build(); -await host.RunAsync(); +await builder.Build().RunAsync(); ``` -**4. Use it in Your Service!** - -Inject `ObsWebSocketClient` and start controlling OBS: +Worker example: ```csharp using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; using ObsWebSocket.Core; -using ObsWebSocket.Core.Events; // For connection events EventArgs -using ObsWebSocket.Core.Events.Generated; // For specific OBS EventArgs -using ObsWebSocket.Core.Protocol.Requests; // For Request DTOs -using ObsWebSocket.Core.Protocol.Responses; // For Response DTOs -using ObsWebSocket.Core.Protocol.Generated; // For enums like MediaInputAction -using ObsWebSocket.Core.Protocol.Common.FilterSettings; // For predefined filter types +using ObsWebSocket.Core.Events.Generated; -namespace YourApplicationNamespace; // <-- Your namespace - -public class MyObsControllerService : BackgroundService +public sealed class Worker(ObsWebSocketClient client) : IHostedService { - private readonly ILogger _logger; - private readonly ObsWebSocketClient _obsClient; - - public MyObsControllerService(ILogger logger, ObsWebSocketClient obsClient) + public async Task StartAsync(CancellationToken ct) { - _logger = logger; - _obsClient = obsClient; - - // --- Subscribe to Events --- - _obsClient.Connected += OnObsConnected; - _obsClient.Disconnected += OnObsDisconnected; - _obsClient.CurrentProgramSceneChanged += OnCurrentProgramSceneChanged; - // Add more event subscriptions as needed! - } + client.CurrentProgramSceneChanged += OnSceneChanged; + await client.ConnectAsync(ct); - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - try - { - _logger.LogInformation("Connecting to OBS..."); - // Connect using the options configured in Program.cs/appsettings.json - await _obsClient.ConnectAsync(stoppingToken); - - if (_obsClient.IsConnected) - { - _logger.LogInformation("Connection to OBS successful!"); - // Now you can safely send requests! - await GetAndLogObsVersion(stoppingToken); - await ExampleHelperUsage(stoppingToken); - - // Keep running until shutdown is requested - await Task.Delay(Timeout.Infinite, stoppingToken); - } - else - { - _logger.LogError("Failed to connect to OBS WebSocket."); - } - } - catch (OperationCanceledException) - { - _logger.LogInformation("OBS Controller stopping."); - } - catch (ObsWebSocketException ex) // Handle OBS-specific connection/request errors - { - _logger.LogError(ex, "OBS WebSocket error: {ErrorMessage}", ex.Message); - } - catch (Exception ex) - { - _logger.LogError(ex, "Unexpected error in OBS Controller Service."); - } - finally - { - // --- Unsubscribe from Events --- - _obsClient.Connected -= OnObsConnected; - _obsClient.Disconnected -= OnObsDisconnected; - _obsClient.CurrentProgramSceneChanged -= OnCurrentProgramSceneChanged; - - // Ensure disconnection on shutdown - if (_obsClient.IsConnected) - { - _logger.LogInformation("Disconnecting from OBS..."); - await _obsClient.DisconnectAsync(); - } - } + var version = await client.GetVersionAsync(cancellationToken: ct); + Console.WriteLine($"Connected to OBS {version?.ObsVersion}"); } - // --- Example Helper Usage --- - private async Task ExampleHelperUsage(CancellationToken cancellationToken) + public async Task StopAsync(CancellationToken ct) { - try + client.CurrentProgramSceneChanged -= OnSceneChanged; + if (client.IsConnected) { - // Check if a source exists - if (await _obsClient.SourceExistsAsync("MyCameraSource", cancellationToken)) - { - _logger.LogInformation("MyCameraSource exists!"); - - // Toggle visibility of a specific item in a scene - bool isNowVisible = await _obsClient.SetSceneItemEnabledAsync( - sceneName: "MainScene", - sourceName: "MyCameraSource", // Find item by source name - isEnabled: null, // Toggle - cancellationToken: cancellationToken - ); - _logger.LogInformation("MyCameraSource visibility toggled. Is now visible: {IsVisible}", isNowVisible); - - // Get typed filter settings (assuming ColorCorrectionFilterSettings record exists) - var colorSettings = await _obsClient.GetSourceFilterSettingsAsync( - sourceName: "MyCameraSource", - filterName: "Color Correction", - cancellationToken: cancellationToken - ); - if (colorSettings != null) { - _logger.LogInformation("Camera saturation: {Saturation}", colorSettings.Saturation); - } - } else { - _logger.LogWarning("MyCameraSource does not exist."); - } - - // Set text on a text source - await _obsClient.SetInputTextAsync("MyTextLabel", "Hello from ObsWebSocket.Core!", cancellationToken); - - // Switch scene using a specific transition and wait for it - await _obsClient.SwitchSceneAndWaitAsync( - sceneName: "GameplayScene", - transitionName: "Fade", - transitionDurationMs: 750, - timeout: TimeSpan.FromSeconds(5), // Wait up to 5s for the change - cancellationToken: cancellationToken - ); - _logger.LogInformation("Switched to GameplayScene and transition finished."); - - // --- Example: Wait for a specific event --- - string mediaSourceName = "IntroVideo"; - _logger.LogInformation("Restarting media source '{MediaSourceName}' and waiting for it to end...", mediaSourceName); - - // 1. Trigger the action - await _obsClient.TriggerMediaInputActionAsync( - new TriggerMediaInputActionRequestData(mediaSourceName, MediaInputAction.Restart), - cancellationToken: cancellationToken - ); - - // 2. Wait for the *specific* event matching the predicate - var endedArgs = await _obsClient.WaitForEventAsync( - predicate: args => args.EventData.InputName == mediaSourceName, // Only care about *this* media source - timeout: TimeSpan.FromSeconds(30), // Wait up to 30 seconds - cancellationToken: cancellationToken - ); - - // 3. Check the result - if (endedArgs != null) - { - _logger.LogInformation("Media source '{MediaSourceName}' finished playback.", mediaSourceName); - } - else - { - _logger.LogWarning("Timed out or was canceled while waiting for media source '{MediaSourceName}' to end.", mediaSourceName); - } - + await client.DisconnectAsync(); } - catch (ObsWebSocketException ex) { _logger.LogError(ex, "Error during helper usage: {Msg}", ex.Message); } - catch (TimeoutException ex) { _logger.LogWarning("Timeout occurred: {Msg}", ex.Message); } - catch (OperationCanceledException) { } } - // --- Example Request Methods --- - private async Task GetAndLogObsVersion(CancellationToken cancellationToken) + private static void OnSceneChanged(object? sender, CurrentProgramSceneChangedEventArgs e) { - try - { - GetVersionResponseData? version = await _obsClient.GetVersionAsync(cancellationToken: cancellationToken); - if (version != null) - { - _logger.LogInformation("Connected to OBS v{ObsVersion} (WebSocket v{WsVersion})", - version.ObsVersion, version.ObsWebSocketVersion); - } - } - catch (ObsWebSocketException ex) { _logger.LogError(ex, "Error getting OBS version."); } - catch (OperationCanceledException) { } // Ignore cancellation + Console.WriteLine($"Program scene: {e.EventData.SceneName}"); } +} +``` - // --- Event Handlers --- - private void OnObsConnected(object? sender, EventArgs e) - { - _logger.LogInformation("Event Handler: Connected to OBS!"); - // Good place to maybe fetch initial state if needed - } +## Helpers and Advanced Usage - private void OnObsDisconnected(object? sender, DisconnectedEventArgs e) - { - _logger.LogWarning("Event Handler: Disconnected from OBS. Reason: {Reason}", e.ReasonException?.Message ?? "Client/Server Request"); - } +Common helper APIs include: + +- `SwitchSceneAndWaitAsync(...)` +- `SetInputTextAsync(...)` +- `SetSceneItemEnabledAsync(...)` +- `SourceExistsAsync(...)` +- `GetSourceFilterSettingsAsync(...)` +- `WaitForEventAsync(...)` - private void OnCurrentProgramSceneChanged(object? sender, CurrentProgramSceneChangedEventArgs e) - { - _logger.LogInformation("Event Handler: Program scene changed to {SceneName}", e.EventData.SceneName); - } +For generated request models and direct requests, see: + +- `ObsWebSocket.Core.Protocol.Requests` +- `ObsWebSocket.Core.Protocol.Responses` +- `ObsWebSocket.Core.Events.Generated` + +Batch API note (AOT-safe path): + +- `BatchRequestItem.RequestData` should be `null`, `JsonElement`, or a generated `*RequestData` DTO from `ObsWebSocket.Core.Protocol.Requests`. +- Arbitrary anonymous/POCO objects are not guaranteed to be serializable in Native AOT builds. + +## Example App + +`ObsWebSocket.Example` contains a host-based sample using configuration + DI. + +- Interactive mode: starts a command loop (`help`, `version`, `scene`, `batch-example`, etc.) +- Transport validation mode: runs JSON + MsgPack validation cycles (scene/input/filter stub-heavy calls), then enters the interactive loop +- One-shot mode: pass a command as process arguments to run it directly and exit (for CI/automation), for example: + - `ObsWebSocket.Example run-transport-tests` + +`appsettings.json`: + +```json +{ + "Obs": { + "ServerUri": "ws://localhost:4455", + "Password": "", + "EventSubscriptions": null, + "Format": "Json" + }, + "ExampleValidation": { + "RunValidationOnStartup": false, + "ValidationIterations": 1 + } } ``` -## Diving Deeper 🏊‍♂️ +Interactive command to run validation on demand: -- **Sending Requests:** Use the `_obsClient.RequestNameAsync(...)` extension methods for direct protocol access. They are generated based on the OBS WebSocket protocol. IntelliSense is your friend! Need to set input settings? `_obsClient.SetInputSettingsAsync(...)`. Need the version? `_obsClient.GetVersionAsync()`. -- **Using Helpers:** For common tasks, explore the helper extension methods available directly on the `_obsClient` instance (like `_obsClient.SetInputTextAsync(...)`, `_obsClient.SwitchSceneAndWaitAsync(...)`, `_obsClient.SourceExistsAsync(...)`, `_obsClient.WaitForEventAsync(...)`, etc.). These often combine multiple direct requests into a simpler call. -- **Request/Response Data:** Many direct requests require input data, and many return data. These use generated C# `record` types found in the `ObsWebSocket.Core.Protocol.Requests` and `ObsWebSocket.Core.Protocol.Responses` namespaces (e.g., `GetVersionResponseData`, `SetInputSettingsRequestData`). The helper methods often abstract these away. -- **Handling OBS Events:** Subscribe to events like `_obsClient.SceneCreated += ...`. The second argument (`e`) of your handler will be a strongly-typed `EventArgs` (like `SceneCreatedEventArgs`) containing an `EventData` property with the specific event details (e.g., `e.EventData.SceneName`). Find all generated EventArgs in `ObsWebSocket.Core.Events.Generated`. -- **Waiting for Events:** Use the `_obsClient.WaitForEventAsync(predicate, timeout, ...)` helper to reliably wait for a specific event that meets certain criteria after performing an action. This is crucial for synchronizing actions. -- **Filter Settings:** Use `_obsClient.GetSourceFilterSettingsAsync(...)` and `_obsClient.SetSourceFilterSettingsAsync(...)` with the predefined records in `ObsWebSocket.Core.Protocol.Common.FilterSettings` (like `ColorCorrectionFilterSettings`) for type-safe filter manipulation. -- **Batching Requests:** Use `_obsClient.CallBatchAsync(...)` to send multiple commands at once for efficiency, especially useful for complex sequences or animations. -- **Re-Identifying:** Use `_obsClient.ReidentifyAsync(...)` to change event subscriptions after the initial connection without disconnecting. -- **Configuration Options:** Check the `ObsWebSocketClientOptions` class for all available settings (timeouts, reconnection behavior, serialization format, etc.). -- **Logging:** Leverage `Microsoft.Extensions.Logging`. Setting the `ObsWebSocket.Core` category to `Trace` provides _very_ detailed logs of connection steps, message sending/receiving, and event processing. +- `run-transport-tests` -## ⚠️ Important Considerations ⚠️ +## Native AOT Example -- **OBS WebSocket v5 Required:** Double-check you're running OBS Studio 28+ and have the WebSocket server enabled (`Tools -> WebSocket Server Settings`). -- **Firewall:** Ensure your firewall allows connections to the port OBS WebSocket is listening on (default: 4455). -- **Error Handling:** Requests can fail! Wrap calls to `_obsClient` methods in `try-catch` blocks to handle `ObsWebSocketException` (for OBS-side errors) and other potential exceptions (like `InvalidOperationException` if not connected, or `TimeoutException` from waiting helpers). +Build and run the example as Native AOT: -## Contributing 🤝 - -Got ideas? Found a bug? Contributions are highly encouraged! Check out the [Contribution Guidelines](CONTRIBUTING.md) to get started. +```bash +dotnet publish ObsWebSocket.Example/ObsWebSocket.Example.csproj -c Release -r win-x64 --self-contained true +./ObsWebSocket.Example/bin/Release/net10.0/win-x64/publish/ObsWebSocket.Example.exe +``` -## License 📄 +## Contributing -This project rocks the **MIT License**. See the [LICENSE.txt](LICENSE.txt) file for the full text. +Contributions are welcome. See [`CONTRIBUTING.md`](CONTRIBUTING.md). ---- +## License -Happy Automating! 🎉 +MIT. See [`LICENSE.txt`](LICENSE.txt).