Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/halomakes/abenity.perks
.NET Standard client for interacting with the Abenity Perks API
https://github.com/halomakes/abenity.perks
abenity api-clent netstandard20
Last synced: 14 days ago
JSON representation
.NET Standard client for interacting with the Abenity Perks API
- Host: GitHub
- URL: https://github.com/halomakes/abenity.perks
- Owner: halomakes
- License: mit
- Created: 2020-04-01T01:08:53.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T20:32:53.000Z (about 2 years ago)
- Last Synced: 2024-12-02T09:44:16.399Z (2 months ago)
- Topics: abenity, api-clent, netstandard20
- Language: C#
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Abenity.Perks [![Version](https://img.shields.io/nuget/vpre/Abenity.Perks)](https://www.nuget.org/packages/Abenity.Perks/) [![Downloads](https://img.shields.io/nuget/dt/Abenity.Perks)](https://www.nuget.org/packages/Abenity.Perks/) [![Build Status](https://api.travis-ci.org/halomademeapc/Abenity.Perks.svg?branch=master)](https://travis-ci.org/github/halomademeapc/Abenity.Perks)
.NET Standard API Client for interacting with the [Abenity Perks API](https://abenity.com/developers/api/perks)
This can be used alongside the [Abenity.Members](https://github.com/halomademeapc/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](https://abenity.com/developers/api/perks) 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.
```json
"Perks": {
"BaseUrl": "https://YOUR_COMPANY.abenity.com/perks/api",
"Username": "abcdefghijkl"
}
```## Example Usage
Register the API Client in your application's service provider
```csharp
var config = new AbenityPerksConfiguration();
Configuration.Bind("Perks", config);
services.AddSingleton(config);services.AddHttpClient();
services.AddScoped();
```Inject it into your service/controller and make a call
```csharp
private readonly IAbenityPerksApiClient perksClient;public MyService(IAbenityPerksApiClient perksClient) {
this.perksClient = perksClient;
}// Get offers using a category object
public async Task> GetOffers() {
var category = (await perksClient.GetCategoriesAsync()).FirstOrDefault();
var deals = await perksClient.GetOffersAsync(category);
return deals;
}// Get offers using a category key
public Task> GetOffers(string key) => perksClient.GetOffersAsync(categoryKey: key);// Get offers using a category ID
public Task> GetOffersById(string id) => perksClient.GetOffersAsync(categoryId: id);
```## Dependencies
* **Newtonsoft.Json** 10.0.3+## Changelog
**0.1.0-alpha** Initial Preview