Skip to content

Commit

Permalink
Fixed CodeFactor issues manually
Browse files Browse the repository at this point in the history
  • Loading branch information
pingu2k4 committed Aug 9, 2024
1 parent 2dbfda8 commit 344d026
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
29 changes: 0 additions & 29 deletions src/PinguApps.Appwrite.Shared/AppwriteResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public AppwriteResult(OneOf<Success, AppwriteError, InternalError> result)

protected AppwriteResult()
{

}

/// <summary>
Expand Down Expand Up @@ -43,31 +42,3 @@ protected AppwriteResult()
/// </summary>
public virtual bool IsInternalError => Result.IsT2;
}


/// <inheritdoc/>
/// <typeparam name="TResult">the type of response expected on success</typeparam>
public class AppwriteResult<TResult> : AppwriteResult
{
public AppwriteResult(OneOf<TResult, AppwriteError, InternalError> result)
{
Result = result;
}

/// <summary>
/// /// The result of making the API call. Can be <see cref="TResult"/>, <see cref="AppwriteError"/> or <see cref="InternalError"/> depending on what happened
/// </summary>
public new OneOf<TResult, AppwriteError, InternalError> Result { get; }

/// <inheritdoc/>
public override bool Success => Result.IsT0;

/// <inheritdoc/>
public override bool IsError => Result.IsT1 || Result.IsT2;

/// <inheritdoc/>
public override bool IsAppwriteError => Result.IsT1;

/// <inheritdoc/>
public override bool IsInternalError => Result.IsT2;
}
30 changes: 30 additions & 0 deletions src/PinguApps.Appwrite.Shared/AppwriteResultOfT.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using OneOf;

namespace PinguApps.Appwrite.Shared;

/// <inheritdoc/>
/// <typeparam name="TResult">the type of response expected on success</typeparam>
public class AppwriteResult<TResult> : AppwriteResult
{
public AppwriteResult(OneOf<TResult, AppwriteError, InternalError> result)
{
Result = result;
}

/// <summary>
/// /// The result of making the API call. Can be <see cref="TResult"/>, <see cref="AppwriteError"/> or <see cref="InternalError"/> depending on what happened
/// </summary>
public new OneOf<TResult, AppwriteError, InternalError> Result { get; }

/// <inheritdoc/>
public override bool Success => Result.IsT0;

/// <inheritdoc/>
public override bool IsError => Result.IsT1 || Result.IsT2;

/// <inheritdoc/>
public override bool IsAppwriteError => Result.IsT1;

/// <inheritdoc/>
public override bool IsInternalError => Result.IsT2;
}

0 comments on commit 344d026

Please sign in to comment.