LuckyCodeIntegration 2.0.16

There is a newer version of this package available.
See the version list below for details.
dotnet add package LuckyCodeIntegration --version 2.0.16
                    
NuGet\Install-Package LuckyCodeIntegration -Version 2.0.16
                    
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="LuckyCodeIntegration" Version="2.0.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LuckyCodeIntegration" Version="2.0.16" />
                    
Directory.Packages.props
<PackageReference Include="LuckyCodeIntegration" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LuckyCodeIntegration --version 2.0.16
                    
#r "nuget: LuckyCodeIntegration, 2.0.16"
                    
#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.
#:package LuckyCodeIntegration@2.0.16
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LuckyCodeIntegration&version=2.0.16
                    
Install as a Cake Addin
#tool nuget:?package=LuckyCodeIntegration&version=2.0.16
                    
Install as a Cake Tool

🧩 LuckyCodeIntegration (.NET)

A modern, secure, and plug-and-play integration package for LuckyCode API

NuGet Version .NET License: MIT


🚀 Overview

The LuckyCodeIntegration package provides an instant and secure way to integrate your .NET applications with the LuckyCode API.
It handles token authentication, API communication, and configuration automatically — allowing developers to focus on business logic instead of setup.


✨ Features

  • 🔐 Built-in Authentication: Auto token retrieval & refresh via EnsureValidToken()
  • ⚙️ Simple Configuration: Reads settings directly from appsettings.json
  • 🧱 Dependency Injection Ready: Uses IHttpClientFactory and IOptions<T>
  • 🔄 Automatic Token Caching: Keeps connections secure and efficient
  • 🧰 Full API Coverage: Supports Pull, Reveal, Redeem, Multi-Pull, and Check Serial Code
  • 🧩 Prebuilt Controller: Optional LuckyCodeController for rapid testing

📦 Installation

Install via NuGet Package Manager or CLI:

dotnet add package LuckyCodeIntegration --version 2.0.13

⚙️ Configuration

appsettings.json

"LuckyCode": {
  "BaseUrl": "https://api.redeemly.com",
  "AccessCredential": {
    "ApiKey": "your-api-key",
    "ClientId": "your-client-id"
  }
}

Program.cs

using LuckyCodeLibrary.IntegrationHelper.Extensions;

builder.Services.AddIntegrationService(
    builder.Configuration.GetSection("LuckyCode").Bind);

🔑 Example Usage

using LuckyCodeLibrary.IntegrationHelper.Services;
using LuckyCodeLibrary.IntegrationHelper.Models;

public class Example
{
    private readonly ILuckyCodeServices _luckyCodeServices;

    public Example(ILuckyCodeServices luckyCodeServices)
    {
        _luckyCodeServices = luckyCodeServices;
    }

    public async Task RunAsync()
    {
        var token = await _luckyCodeServices.EnsureValidToken();

        var request = new PullCodeRequest
        {
            CustomerRef = "CUST-12345",
            Quantity = 1
        };

        var result = await _luckyCodeServices.PullCode(request, token);

        if (result.Success)
            Console.WriteLine($"Code Pulled: {result.Data.Code}");
        else
            Console.WriteLine($"Error: {result.Message}");
    }
}

🧩 Available Endpoints

Method Endpoint Description
POST /lucky-code-adapter/pull Pulls a new code
POST /lucky-code-adapter/reveal Reveals hidden code details
POST /lucky-code-adapter/redeem Redeems a code
POST /lucky-code-adapter/multi-pull Pulls multiple codes
GET /lucky-code-adapter/check-serialcode Validates a serial code

🧠 Internal Logic

  • EnsureValidToken()
    • Fetches a bearer token from LuckyCode API using API Key & Client ID.
    • Caches it in memory and refreshes automatically before expiration.

✅ Client Integration Demo

A sample .NET project was built to simulate a real client using this package.
The demo successfully validated:

  • Configuration binding
  • Token management
  • Secure API communication
  • Fast setup (under 10 minutes)

📄 License

Licensed under the MIT License — free for commercial and private use.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
2.0.33 114 2/16/2026
2.0.32 107 2/12/2026
2.0.31 107 2/5/2026
2.0.30 117 2/5/2026
2.0.29 112 2/5/2026
2.0.28 107 2/5/2026
2.0.27 112 2/5/2026
2.0.26 109 2/5/2026
2.0.25 116 2/4/2026
2.0.23 113 2/4/2026
2.0.22 117 2/4/2026
2.0.21 116 2/4/2026
2.0.20 115 2/4/2026
2.0.19 121 2/3/2026
2.0.18 117 2/3/2026
2.0.16 185 10/13/2025
2.0.14 188 10/13/2025
2.0.13 194 10/9/2025