OSK.Functions.Outputs.Abstractions 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package OSK.Functions.Outputs.Abstractions --version 2.0.1                
NuGet\Install-Package OSK.Functions.Outputs.Abstractions -Version 2.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OSK.Functions.Outputs.Abstractions" Version="2.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OSK.Functions.Outputs.Abstractions --version 2.0.1                
#r "nuget: OSK.Functions.Outputs.Abstractions, 2.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install OSK.Functions.Outputs.Abstractions as a Cake Addin
#addin nuget:?package=OSK.Functions.Outputs.Abstractions&version=2.0.1

// Install OSK.Functions.Outputs.Abstractions as a Cake Tool
#tool nuget:?package=OSK.Functions.Outputs.Abstractions&version=2.0.1                

OSK.Functions.Outputs

The library is meant to faciliate easy to use output responses from various APIs, functions, and other types of calls that can occur in an application. These outputs can provide quick and meaningful information to a caller beyond a simple exception or other error data. Response information can include specific error messages, exceptions or non-error information such as specificty codes, run timer metrics, response dates, etc.

The main data points on an output response are:

  • OuputStatusCode: Provides quick reference to the response OutputSpecificityCode. These specificity code shares a lot of status codes with HttpStatusCode, but does differ in some parts that are more nuanced for function responses
  • ErrorInformation: Provides error related information, if the specificity code for a response is an error code. This can either be an error message or an exception

An output's code can be easily represented by the following template

{specificity code}, {optional origination source}

The string form of the codes should hopefully make checking/debugging error information easier by allowing more complex error scenarios to be viewable in a concise form. For example, a function that has successfully completed a task and has queued an asynchronous job can be shown as 202, OSK.Job.Service

For future codes that may be added, the following represents the different groupings of codes:

  • The range of 200-299 represents success codes
  • The range of 400-499 represents error codes
  • The range of 500-599 represents fault codes

Abstractions

The abstraction layer should allow libraries that only need access to the interfaces to avoid adding a dependency on the core output logic, thus reducing unnecessary dependency requirements. An application should add the core logic and any extra libraries being added can simply add the dependency for the abstractions project.

Mocks

The mocks project provides a quick set of factory objects that should help with streamlining unit tests with the library. They are set up to avoid running core output logic and to skip any ILogger dependency requirement. By using the needed MockOutputFactory or MockOutputFactory<T> objects, users should be able to skip needing to mock the necessary ports for DI

Usage: Consumers

The central focal point to this library is the IOutputFactory and IOutputFactory<T> objects. By adding a dependency to the Outputs.Logging or base Outputs, an application will gain access to the functionality through dependency injection. IOutputFactory is a basic implementation that avoids a dependency on Microsoft's Logging mechanism, while IOutputFactory<T> will use an ILogger to record error responses. Some useful shortcuts to creating outputs can be found in the OutputFactoryExtensions. Callers can add the dependency by using AddFunctionOutputs or AddLoggingFunctionOutputs functions on a service collection.

Notes:

  • The internal logic will prevent creating an error output that has no error information attached (i.e. exception data, error strings, etc.)
  • OriginationSource on the IOutput status code is meant to convey the base application where the error orignated from. This does not need to be used, but can help provide extra debug information should issues/errors occur in an application's lifetime. Being a string can help to ensure broad usage of identification to most projects in the wild.
  • IPaginatedOutput can help to make list style calls return extra data relating to total items in the data set, skip/take, etc. and can facilitate pagination for front-end usage. This can be generated using the CreatePage from the IOutputFactory
  • ResultSpecificity codes do have some similar codes/values to HttpStatusCodes, but this is only coincidential and should not be expected to be upheld in all cases.

Contributions and Issues

Any and all contributions are appreciated! Please.3 be sure to follow the branch naming convention OSK-{issue number}-{deliminated}-{branch}-{name} as current workflows rely on it for automatic issue closure. Please submit issues for discussion and tracking using the github issue tracker. Feel free to create issues to discuss adding more nuanced specificity or other result codes.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on OSK.Functions.Outputs.Abstractions:

Package Downloads
OSK.Functions.Outputs.Logging.Abstractions

Provides an abstraction for a .NET mechanism that returns outputs or error information, with an ability for logging outputs, to callers in a simple to use and consolidated way.

OSK.Functions.Outputs

Provides a .NET mechanism for returning outputs or error information to callers in a simple to use and consolidated way.

OSK.Storage.Abstractions

A set of abstractions for saving and loading object data from storage in .NET.

OSK.Functions.Outputs.Mocks

An implementation for OSK.Functions.Outputs meant mainly for unit testing purposes

OSK.Hexagonal.Abstractions

A set of interfaces meant to help with hexagonally developed libraries.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.1 50 1/10/2025
2.1.0 44 1/8/2025
2.0.1 55 1/7/2025
2.0.0 114 1/7/2025
1.5.2 786 12/2/2024
1.5.1 810 12/1/2024
1.5.0 496 8/9/2024
1.4.0 552 4/10/2024
1.3.0 280 3/31/2024
1.2.1 616 3/27/2024
1.2.0 260 3/27/2024
1.1.0 600 3/26/2024
1.0.1 222 3/26/2024
1.0.0 299 3/24/2024