From 8ae9327c96c25efd63e4d4a0d3fd2e11c8cba344 Mon Sep 17 00:00:00 2001 From: MohammadAhmdi Date: Mon, 19 Oct 2026 23:55:57 +0330 Subject: [PATCH] docs(result): document QuickbaseResult API --- .../Helpers/QuickbaseCommandBuilder.cs | 4 +- QuickbaseNet/QuickbaseNet.csproj | 3 +- QuickbaseNet/QuickbaseResult.cs | 61 ++++++++++++++++++- 3 files changed, 63 insertions(+), 5 deletions(-) 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 +}