DiterionLabs.USSD 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package DiterionLabs.USSD --version 1.0.3
NuGet\Install-Package DiterionLabs.USSD -Version 1.0.3
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="DiterionLabs.USSD" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DiterionLabs.USSD --version 1.0.3
#r "nuget: DiterionLabs.USSD, 1.0.3"
#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 DiterionLabs.USSD as a Cake Addin
#addin nuget:?package=DiterionLabs.USSD&version=1.0.3

// Install DiterionLabs.USSD as a Cake Tool
#tool nuget:?package=DiterionLabs.USSD&version=1.0.3

Diterion Labs USSD Library

Usage

  1. Have a redis connection string in your appsettings.json with name Redis

  2. Register the USSD dependences in your Startup.cs

builder.Services.AddUSSDMenus();
  1. In your controller, inject the USSDService and call the ProccessRequest<InitialMenu>() function in your controller action
[Route("api/ussd")]
[ApiController]
public class USSDController : ControllerBase
{
    private readonly USSDService _ussdService;
    public USSDController(USSDService ussdService) =>
        _ussdService = ussdService;    

    [HttpGet]
    public async Task Index([FromQuery] USSDRequest request) => 
        await _ussdService.ProcessRequest<InitialMenu>(request);
}

Creating Menus

Menus should have a [USSDMenu] attribute and implement the IUSSDMenu interface.


[USSDMenu]
public class InitialMenu : IUSSDMenu
{
    public async Task DisplayAsync(USSDRequest request)
    {
        // Implement logic
    }

    public async Task ProcessInputAsync(USSDRequest request)
    {
        // Implement logic
    }
}

To implement the DisplayAsync and the ProcessInputAsync, you can make use of the IUSSDMenuBuilder which can be injected in the menu class

[USSDMenu]
public class InitialMenu : IUSSDMenu
{
    private readonly IUSSDMenuBuilder _builder;
    public InitialMenu(IUSSDMenuBuilder builder) => 
        _builder = builder;

    public async Task DisplayAsync(USSDRequest request)
    {
        // Implement logic
    }

    public async Task ProcessInputAsync(USSDRequest request)
    {
        // Implement logic
    }
}
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.6 268 4/18/2023
1.1.5 153 4/18/2023
1.1.4 156 4/18/2023
1.1.3 167 4/17/2023
1.1.2 148 4/17/2023
1.1.0 148 4/17/2023
1.0.9 154 4/17/2023
1.0.7 159 4/17/2023
1.0.6 161 4/14/2023
1.0.5 154 4/14/2023
1.0.4 162 4/13/2023
1.0.3 281 1/20/2023
1.0.2 262 1/20/2023
1.0.1 258 1/20/2023
1.0.0 260 1/20/2023