Abenity.Perks 0.1.0-alpha

This is a prerelease version of Abenity.Perks.
Install-Package Abenity.Perks -Version 0.1.0-alpha
dotnet add package Abenity.Perks --version 0.1.0-alpha
<PackageReference Include="Abenity.Perks" Version="0.1.0-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Abenity.Perks --version 0.1.0-alpha
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Abenity.Perks, 0.1.0-alpha"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Abenity.Perks as a Cake Addin
#addin nuget:?package=Abenity.Perks&version=0.1.0-alpha&prerelease

// Install Abenity.Perks as a Cake Tool
#tool nuget:?package=Abenity.Perks&version=0.1.0-alpha&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Abenity.Perks NuGet Logo

.NET Standard API Client for interacting with the Abenity Perks API This can be used alongside the Abenity.Members library to send users directly to a deal's details page.

This code has not been fully-tested and is provided as-is. I do not have an account with access to the Perks API so this is based on the limited documentation at Abenity's developer site. If you have any issues please let me know or submit a bug and I will take a look.

Configuration

The following information is required to authorize API requests.

  1. A "username" (an API key)
  2. Your client subdomain (mycompany.abenity.com)

Provided below is an example configuration section.

"Perks": {
    "BaseUrl": "https://YOUR_COMPANY.abenity.com/perks/api",
    "Username": "abcdefghijkl"
}

Example Usage

Register the API Client in your application's service provider

var config = new AbenityPerksConfiguration();
Configuration.Bind("Perks", config);
services.AddSingleton(config);

services.AddHttpClient();
services.AddScoped<IAbenityPerksApiClient, AbenityPerksApiClient>();

Inject it into your service/controller and make a call

private readonly IAbenityPerksApiClient perksClient;

public MyService(IAbenityPerksApiClient perksClient) {
    this.perksClient = perksClient;
}

// Get offers using a category object
public async Task<IEnumerable<OfferSet>> GetOffers() {
    var category = (await perksClient.GetCategoriesAsync()).FirstOrDefault();
    var deals = await perksClient.GetOffersAsync(category);
    return deals;
}

// Get offers using a category key
public Task<IEnumerable<OfferSet>> GetOffers(string key) => perksClient.GetOffersAsync(categoryKey: key);

// Get offers using a category ID
public Task<IEnumerable<OfferSet>> GetOffersById(string id) =>  perksClient.GetOffersAsync(categoryId: id);

Dependencies

  • NewtonSoft.Json 10.0.3+

Changelog

0.1.0-alpha Initial Preview

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
0.1.0-alpha 236 4/1/2020

Initial preview