diff --git a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IKSqlDbParameters.cs b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IKSqlDbParameters.cs index 90eb4555..d1c34652 100644 --- a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IKSqlDbParameters.cs +++ b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IKSqlDbParameters.cs @@ -1,6 +1,13 @@ namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters; +/// +/// Represents parameters for a KSqlDb endpoint. +/// public interface IKSqlDbParameters : IQueryParameters { + /// + /// Clones the current parameters. + /// + /// A new instance of the parameters with the same values. IKSqlDbParameters Clone(); } diff --git a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IPullQueryParameters.cs b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IPullQueryParameters.cs index 19d85eb8..543744ca 100644 --- a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IPullQueryParameters.cs +++ b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IPullQueryParameters.cs @@ -1,6 +1,8 @@ -namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters +namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters; + +/// +/// Represents parameters for a pull query. +/// +public interface IPullQueryParameters : IKSqlDbParameters { - public interface IPullQueryParameters : IKSqlDbParameters - { - } } diff --git a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IPushQueryParameters.cs b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IPushQueryParameters.cs index 86cb0eb6..8959d028 100644 --- a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IPushQueryParameters.cs +++ b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IPushQueryParameters.cs @@ -1,9 +1,11 @@ using ksqlDB.RestApi.Client.KSql.Query.Options; -namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters +namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters; + +/// +/// Represents parameters for a push query. +/// +public interface IPushQueryParameters : IKSqlDbParameters { - public interface IPushQueryParameters : IKSqlDbParameters - { - AutoOffsetReset AutoOffsetReset { get; set; } - } + AutoOffsetReset AutoOffsetReset { get; set; } } diff --git a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IQueryParameters.cs b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IQueryParameters.cs index c8f86a36..e958ea6e 100644 --- a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IQueryParameters.cs +++ b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/IQueryParameters.cs @@ -1,8 +1,19 @@ -namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters; +namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters; +/// +/// Represents query parameters for a KSqlDb endpoint. +/// public interface IQueryParameters : IQueryOptions { + /// + /// A semicolon-delimited sequence of SQL statements to run. + /// string Sql { get; set; } - + + /// + /// Indexer to access properties by key. + /// + /// The key of the property. + /// The value of the property. string this[string key] { get; set; } -} \ No newline at end of file +} diff --git a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/PullQueryParameters.cs b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/PullQueryParameters.cs index 9f9d51bd..b82af70d 100644 --- a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/PullQueryParameters.cs +++ b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/PullQueryParameters.cs @@ -1,6 +1,8 @@ -namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters +namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters; + +/// +/// Represents parameters for a pull query endpoint. +/// +public class PullQueryParameters : QueryEndpointParameters, IPullQueryParameters { - public class PullQueryParameters : QueryEndpointParameters, IPullQueryParameters - { - } } diff --git a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/PullQueryStreamParameters.cs b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/PullQueryStreamParameters.cs index 1d0c45af..6d429e82 100644 --- a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/PullQueryStreamParameters.cs +++ b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/PullQueryStreamParameters.cs @@ -1,6 +1,8 @@ -namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters +namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters; + +/// +/// Represents parameters for a pull query stream endpoint. +/// +public class PullQueryStreamParameters : QueryStreamEndpointParameters, IPullQueryParameters { - public class PullQueryStreamParameters : QueryStreamEndpointParameters, IPullQueryParameters - { - } } diff --git a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryEndpointParameters.cs b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryEndpointParameters.cs index 08e59a57..ed9732ad 100644 --- a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryEndpointParameters.cs +++ b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryEndpointParameters.cs @@ -1,53 +1,73 @@ using System.Text.Json.Serialization; using ksqlDB.RestApi.Client.KSql.RestApi.Statements; -namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters +namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters; + +/// +/// Represents parameters for a '/query' endpoint. +/// +/// The type of the query stream endpoint parameters. +public class QueryEndpointParameters : IKSqlDbParameters + where T : QueryEndpointParameters, new() { - public class QueryEndpointParameters : IKSqlDbParameters - where T : QueryEndpointParameters, new() + /// + /// A semicolon-delimited sequence of SQL statements to run. + /// + [JsonPropertyName("ksql")] + public string Sql { get; set; } = null!; + + /// + /// Property overrides to run the statements with. + /// + [JsonPropertyName("streamsProperties")] + public Dictionary Properties { get; } = new(); + + /// + /// Indexer to access properties by key. + /// + /// The key of the property. + /// The value of the property. + public string this[string key] { - /// - /// A semicolon-delimited sequence of SQL statements to run. - /// - [JsonPropertyName("ksql")] - public string Sql { get; set; } = null!; - - /// - /// Property overrides to run the statements with. - /// - [JsonPropertyName("streamsProperties")] - public Dictionary Properties { get; } = new(); - - public string this[string key] - { - get => Properties[key]; - set => Properties[key] = value; - } + get => Properties[key]; + set => Properties[key] = value; + } - internal EndpointType EndpointType { get; set; } = EndpointType.Query; + internal EndpointType EndpointType { get; set; } = EndpointType.Query; - public void FillFrom(IKSqlDbParameters parameters) - { - this.FillQueryParametersFrom(parameters); - } + /// + /// Fills the parameters from another set of parameters. + /// + /// The parameters to fill from. + public void FillFrom(IKSqlDbParameters parameters) + { + this.FillQueryParametersFrom(parameters); + } - public IKSqlDbParameters Clone() + /// + /// Clones the current parameters. + /// + /// A new instance of the parameters with the same values. + public IKSqlDbParameters Clone() + { + var queryParams = new T() { - var queryParams = new T() - { - Sql = Sql, - EndpointType = EndpointType - }; + Sql = Sql, + EndpointType = EndpointType + }; - foreach (var entry in Properties) - queryParams.Properties.Add(entry.Key, entry.Value); + foreach (var entry in Properties) + queryParams.Properties.Add(entry.Key, entry.Value); - return queryParams; - } + return queryParams; + } - public override string ToString() - { - return this.ToLogInfo(); - } + /// + /// Returns a string representation of the object. + /// + /// A string representation of the object. + public override string ToString() + { + return this.ToLogInfo(); } } diff --git a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryParameters.cs b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryParameters.cs index 96905cb2..2b2fb9ba 100644 --- a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryParameters.cs +++ b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryParameters.cs @@ -3,10 +3,16 @@ namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters; +/// +/// Represents parameters for a query. +/// public class QueryParameters : QueryEndpointParameters, IPushQueryParameters { public static readonly string AutoOffsetResetPropertyName = "ksql.streams.auto.offset.reset"; + /// + /// Sets the auto offset reset using . + /// [JsonIgnore] public AutoOffsetReset AutoOffsetReset { diff --git a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryParametersExtensions.cs b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryParametersExtensions.cs index 774d8e4d..eb5c4f46 100644 --- a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryParametersExtensions.cs +++ b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryParametersExtensions.cs @@ -19,7 +19,7 @@ internal static void FillQueryParametersFrom(this IQueryParameters destination, destination.Properties.Add(entry.Key, entry.Value); } - public static string ToLogInfo(this IQueryParameters queryParameters) + internal static string ToLogInfo(this IQueryParameters queryParameters) { var sb = new StringBuilder(); diff --git a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryStreamEndpointParameters.cs b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryStreamEndpointParameters.cs index 5629bee9..9f8d53ee 100644 --- a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryStreamEndpointParameters.cs +++ b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryStreamEndpointParameters.cs @@ -1,43 +1,70 @@ using System.Text.Json.Serialization; -namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters +namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters; + +/// +/// Represents parameters for a '/query-stream' endpoint. +/// +/// The type of the query stream endpoint parameters. +public class QueryStreamEndpointParameters : IKSqlDbParameters + where T : QueryStreamEndpointParameters, new() { - public class QueryStreamEndpointParameters : IKSqlDbParameters - where T : QueryStreamEndpointParameters, new() - { - [JsonPropertyName("sql")] - public string Sql { get; set; } = null!; + /// + /// A semicolon-delimited sequence of SQL statements to run. + /// + [JsonPropertyName("sql")] + public string Sql { get; set; } = null!; - [JsonPropertyName("properties")] - public Dictionary Properties { get; } = new(); + /// + /// Property overrides to run the statements with. + /// + [JsonPropertyName("properties")] + public Dictionary Properties { get; } = new(); - public string this[string key] - { - get => Properties[key]; - set => Properties[key] = value; - } + /// + /// Indexer to access properties by key. + /// + /// The key of the property. + /// The value of the property. + public string this[string key] + { + get => Properties[key]; + set => Properties[key] = value; + } + + /// + /// Fills the parameters from another set of parameters. + /// + /// The parameters to fill from. + public void FillFrom(IKSqlDbParameters parameters) + { + this.FillQueryParametersFrom(parameters); + } - public void FillFrom(IKSqlDbParameters parameters) - { - this.FillQueryParametersFrom(parameters); - } - public IKSqlDbParameters Clone() + /// + /// Clones the current parameters. + /// + /// A new instance of the parameters with the same values. + public IKSqlDbParameters Clone() + { + var queryParams = new T() { - var queryParams = new T() - { - Sql = Sql - }; + Sql = Sql + }; - foreach (var entry in Properties) - queryParams.Properties.Add(entry.Key, entry.Value); + foreach (var entry in Properties) + queryParams.Properties.Add(entry.Key, entry.Value); - return queryParams; - } + return queryParams; + } - public override string ToString() - { - return this.ToLogInfo(); - } + /// + /// Returns a string representation of the object. + /// + /// A string representation of the object. + public override string ToString() + { + return this.ToLogInfo(); } } diff --git a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryStreamParameters.cs b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryStreamParameters.cs index 292426ae..3341ddf7 100644 --- a/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryStreamParameters.cs +++ b/ksqlDb.RestApi.Client/KSql/RestApi/Parameters/QueryStreamParameters.cs @@ -3,10 +3,16 @@ namespace ksqlDB.RestApi.Client.KSql.RestApi.Parameters; +/// +/// Represents parameters for a query stream. +/// public sealed class QueryStreamParameters : QueryStreamEndpointParameters, IPushQueryParameters { public static readonly string AutoOffsetResetPropertyName = "auto.offset.reset"; + /// + /// Sets the auto offset reset using . + /// [JsonIgnore] public AutoOffsetReset AutoOffsetReset {