Skip to content

Replace local Result types with Kebechet.Types.Result package #54

@Kebechet

Description

@Kebechet

The Result and Result<TError> types in Models/Result.cs have been extracted into a standalone NuGet package: Kebechet.Types.Result 1.0.0.

The package additionally introduces DataResult<TValue> and DataResult<TValue, TError> for value-carrying outcomes that don't need a per-operation subclass.

Migration steps

  1. Add the package reference to src/Maui.Health/Maui.Health.csproj:
    <PackageReference Include="Kebechet.Types.Result" Version="1.0.0" />
  2. Delete src/Maui.Health/Models/Result.cs.
  3. Update using directives in files that reference Result / Result<TError> — replace using Maui.Health.Models; with using Types.Result; (or add the latter alongside the former where other types from Models are also used).
  4. Verify the consuming subclasses still compile. Affected files (each derives from Result or Result<TError>):
    • Models/ChangesTokenResult.cs
    • Models/ChangesReadResult.cs
    • Models/AggregatedReadResult.cs
    • Models/AggregatedIntervalReadResult.cs
    • Models/HealthRecordReadResult.cs
    • Models/HealthDataReadResult.cs
    • Models/HealthRecordResult.cs (ReadRecordResult)
    • Models/RequestPermissionResult.cs
    • Models/UpdateHealthDataResult.cs
    • Models/WriteHealthDataResult.cs
    • Models/WorkoutReadResult.cs
  5. Update Platforms/Android/Extensions/ContextExtensions.cs (uses new Result<SdkStatus>()).
  6. Build and run tests.

Notes

  • The package's public API is identical to the in-repo types (same property names, same XML semantics for IsSuccess / Error / ErrorException), so derived classes need no behavioral changes.
  • The package targets net6.0 through net10.0, so all current Maui.Health TFMs are covered.
  • dont expose it to consumer of the library if possible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions