diff --git a/QuickbaseNet/Helpers/QuickbaseCommandBuilder.cs b/QuickbaseNet/Helpers/QuickbaseCommandBuilder.cs index dbc6330..df672cc 100644 --- a/QuickbaseNet/Helpers/QuickbaseCommandBuilder.cs +++ b/QuickbaseNet/Helpers/QuickbaseCommandBuilder.cs @@ -128,8 +128,8 @@ public RecordBuilder AddField(int fieldId, T value) /// /// Adds multiple fields to the record being built. /// - /// - /// + /// The field IDs and values to add to the record. + /// The current instance. public RecordBuilder AddFields(params (int fieldId, dynamic value)[] fields) { foreach (var field in fields) diff --git a/QuickbaseNet/QuickbaseNet.csproj b/QuickbaseNet/QuickbaseNet.csproj index 2c5fa64..25e1c4c 100644 --- a/QuickbaseNet/QuickbaseNet.csproj +++ b/QuickbaseNet/QuickbaseNet.csproj @@ -25,8 +25,7 @@ git true - $(NoWarn);1591 MIT - \ No newline at end of file + diff --git a/QuickbaseNet/QuickbaseResult.cs b/QuickbaseNet/QuickbaseResult.cs index 45cf79c..213d3da 100644 --- a/QuickbaseNet/QuickbaseResult.cs +++ b/QuickbaseNet/QuickbaseResult.cs @@ -3,8 +3,17 @@ namespace QuickbaseNet { + /// + /// Represents the outcome of a Quickbase operation. + /// public class QuickbaseResult { + /// + /// Initializes a new instance of the class. + /// + /// Whether the operation succeeded. + /// The error associated with a failed operation, or on success. + /// The success state and error value are inconsistent. protected internal QuickbaseResult(bool isSuccess, QuickbaseError quickbaseError) { if (isSuccess && quickbaseError != QuickbaseError.None || @@ -17,37 +26,87 @@ protected internal QuickbaseResult(bool isSuccess, QuickbaseError quickbaseError QuickbaseError = quickbaseError; } + /// + /// Gets a value indicating whether the operation succeeded. + /// public bool IsSuccess { get; } + /// + /// Gets a value indicating whether the operation failed. + /// public bool IsFailure => !IsSuccess; + /// + /// Gets the error associated with the operation, or when it succeeded. + /// public QuickbaseError QuickbaseError { get; } + /// + /// Creates a successful result without a value. + /// + /// A successful result. public static QuickbaseResult Success() => new QuickbaseResult(true, QuickbaseError.None); + /// + /// Creates a successful result containing the specified value. + /// + /// The type of the result value. + /// The value to include in the result. + /// A successful result containing . public static QuickbaseResult Success(TValue value) => new QuickbaseResult(value, true, QuickbaseError.None); + /// + /// Creates a failed result without a value. + /// + /// The error that caused the operation to fail. + /// A failed result containing . public static QuickbaseResult Failure(QuickbaseError quickbaseError) => new QuickbaseResult(false, quickbaseError); + /// + /// Creates a failed result with the specified value type. + /// + /// The type of value the result would contain on success. + /// The error that caused the operation to fail. + /// A failed result containing . public static QuickbaseResult Failure(QuickbaseError quickbaseError) => new QuickbaseResult(default, false, quickbaseError); } + /// + /// Represents the outcome of a Quickbase operation that returns a value. + /// + /// The type of value returned by a successful operation. public class QuickbaseResult : QuickbaseResult { private readonly TValue _value; + /// + /// Initializes a new instance of the class. + /// + /// The value returned by a successful operation. + /// Whether the operation succeeded. + /// The error associated with a failed operation, or on success. + /// The success state and error value are inconsistent. protected internal QuickbaseResult(TValue value, bool isSuccess, QuickbaseError quickbaseError) : base(isSuccess, quickbaseError) { _value = value; } + /// + /// Gets the value returned by a successful operation. + /// + /// The result represents a failed operation. public TValue Value => IsSuccess ? _value : throw new InvalidOperationException("The value of a failure result can't be accessed."); + /// + /// Converts a value to a successful result, or a null value to a failed result. + /// + /// The value to convert. + /// A successful result containing , or a failed result with when is null. public static implicit operator QuickbaseResult(TValue value) => !(value == null) ? Success(value) : Failure(QuickbaseError.NullValue); } -} \ No newline at end of file +}