mark-pro / Genesis.MinimalApis

Genesis.MinimalApis aims to expand and create organization for Microsoft's Minimal APIs.
MIT License
1 stars 0 forks source link

Treat Refit's IApiResponse as a monad and computation #19

Open mark-pro opened 1 year ago

mark-pro commented 1 year ago

The idea is to treat Refit's IApiResponse as a monad or monadic computation and provide conversions from IApiResponse to LanguageExt monadic types.

mark-pro commented 1 year ago
app.MapGet(
    "/{input}", 
    (MyRefitClient client, Input input) =>
        client.GetSomething()
        .Map(body => /*do something with body*/ body) 
        .ToResult()
).AddValidationFilter<Input>();