PinMeTo.Client
1.1.0
See the version list below for details.
dotnet add package PinMeTo.Client --version 1.1.0
NuGet\Install-Package PinMeTo.Client -Version 1.1.0
<PackageReference Include="PinMeTo.Client" Version="1.1.0" />
<PackageVersion Include="PinMeTo.Client" Version="1.1.0" />
<PackageReference Include="PinMeTo.Client" />
paket add PinMeTo.Client --version 1.1.0
#r "nuget: PinMeTo.Client, 1.1.0"
#:package PinMeTo.Client@1.1.0
#addin nuget:?package=PinMeTo.Client&version=1.1.0
#tool nuget:?package=PinMeTo.Client&version=1.1.0
pinmeto-client
A .NET client for PinMeTo
Usage
- Import NuGet package PinMeTo.Client
- Implement a record representing the custom data of your PinMeToAccount.
- Add the client to your DI container by using one of the extension methods in the
TheCodePatch.PinMeTo.Clientnamespace and apply the appropriate configuration. - Resolve the
ILocationsService<TYourCustomData>and use it to interact with the API.
Each step is explained in the sections below.
Import NuGet package PinMeTo.Client
dotnet add package PinMeTo.Client
Custom data
You need to implement a model of the custom data configured in your PinMeTo account.
This is a simple POCO whose properties have the same name as your custom data properties,
or are mapped using System.Text.Json.Serialization.JsonPropertyNameAttribute attributes.
Example:
public record MyCustomData
{
[JsonPropertyName("premstore")]
public bool IsPremiumStore { get; set; }
}
Add the client to your DI container
You add the client to your DI container using one of two extension methods in the TheCodePatch.PinMeTo.Client namespace.
If you want your connection details in a config file
Add the following section to your configuration:
"PinMeToClient": {
"ApiBaseAddress": "https://api.test.pinmeto.com",
"AppId": "insert app id",
"AppSecret": "insert app secret",
"AccountId": "insert account id"
},
And use the following method on your IServiceCollection during DI container setup:
serviceCollection.AddPinMeToClient<MyCustomData>(conf.GetSection("PinMeToClient"))
If you want to configure the client in code
Use the following method on your IServiceCollection during DI container setup:
serviceCollection.AddPinMeToClient<MyCustomData>(
c =>
{
c.AccountId = "my account id";
c.AppId = "my app id";
c.AppSecret = "my app secret";
c.ApiBaseAddress = new Uri("https://api.test.pinmeto.com");
}
)
Resolve the locations service
Example:
public class MyController: Controller
{
private ILocationsService<MyCustomData> _locationsService;
public MyController(ILocationsService<MyCustomData> locationsService)
{
_locationsService = locationsService;
}
public Task<LocationDetails<MyCustomData>> GetLocation(string storeId)
{
return _locationsService.Get(storeId);
}
}
Contributing
Please use CSharpier with Run on save activated to keep formatting consistent.
To run unit tests, you need to have an appsettings.private.json file in the unit test project.
Copy the already existing file appsettings.private.json.example and remove the .example suffix.
Then enter the connection details for your PinMeTo account (note! don't use a production account, as
the test add new stores to the account.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. 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. 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. |
-
net6.0
- Microsoft.Extensions.Http (>= 6.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 6.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 6.0.0)
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.2.0 | 198 | 6/10/2024 |
| 1.1.4 | 331 | 4/14/2023 |
| 1.1.3 | 299 | 4/12/2023 |
| 1.1.2 | 279 | 4/12/2023 |
| 1.1.1 | 404 | 12/8/2022 |
| 1.1.0 | 395 | 12/8/2022 |
| 1.0.0 | 461 | 10/25/2022 |
| 1.0.0-beta | 268 | 9/30/2022 |
| 0.1.14-alpha | 257 | 9/30/2022 |
| 0.1.13-alpha | 267 | 9/29/2022 |
| 0.1.12-alpha | 281 | 9/28/2022 |
| 0.1.11-alpha | 292 | 9/27/2022 |
| 0.1.10-alpha | 268 | 9/27/2022 |
| 0.1.9-alpha | 292 | 9/27/2022 |
| 0.1.8-alpha | 294 | 9/27/2022 |
| 0.1.7-alpha | 295 | 9/26/2022 |
| 0.1.6-alpha | 303 | 9/23/2022 |
| 0.1.5-alpha | 286 | 9/23/2022 |
| 0.1.4-alpha | 269 | 9/23/2022 |
| 0.1.3-alpha | 292 | 9/22/2022 |
| 0.1.2-alpha | 275 | 9/22/2022 |
| 0.1.1-alpha | 303 | 9/22/2022 |
| 0.1.0-alpha | 274 | 9/22/2022 |