Dialect.VismaNetCore
0.4.0-alpha.168
Prefix Reserved
This package is deprecated and won't be updated. Switch over to Evolvit.VismaNetCore to continue recieving updates.
dotnet add package Dialect.VismaNetCore --version 0.4.0-alpha.168
NuGet\Install-Package Dialect.VismaNetCore -Version 0.4.0-alpha.168
<PackageReference Include="Dialect.VismaNetCore" Version="0.4.0-alpha.168" />
<PackageVersion Include="Dialect.VismaNetCore" Version="0.4.0-alpha.168" />
<PackageReference Include="Dialect.VismaNetCore" />
paket add Dialect.VismaNetCore --version 0.4.0-alpha.168
#r "nuget: Dialect.VismaNetCore, 0.4.0-alpha.168"
#:package Dialect.VismaNetCore@0.4.0-alpha.168
#addin nuget:?package=Dialect.VismaNetCore&version=0.4.0-alpha.168&prerelease
#tool nuget:?package=Dialect.VismaNetCore&version=0.4.0-alpha.168&prerelease
Visma.Net Core
This is an API wrapper written in C# for dotnet core to enable simplified use of the Visma.NET API, both version 2 and version 3. With support for Dependency Injection for smarter use for hosted services
This README is a work in progress and information might be incomplete or outdated.
Usage/Examples
Simplified examples of usage.
Dependency Injection
Console Application
using VismaNetCore;
var services = new ServiceCollection();
services.AddVismaNetClient(vismaNetOptions => {
vismaNetOptions.GrantType = "client_credentials";
vismaNetOptions.ClientId = "client_id";
vismaNetOptions.ClientSecret = "client_secret";
vismaNetOptions.TenantId = "tenant_id";
vismaNetOptions.Scopes =
[
Scope.ErpServiceCreate,
Scope.ErpServiceDelete,
Scope.ErpServiceRead,
Scope.ErpServiceUpdate,
Scope.SalesOrderRead,
Scope.SalesOrderWrite
];
})
services.AddSingleton<ImplementingClass>();
var serviceProvider = services.BuildServiceProvider();
var testClient = servicesProvider.GetRequiredService<ImplementingClass>();
await testClient.Test();
public class ImplementingClass
{
private readonly VismaNetClient _vismaNetClient;
public ImplementingClass(VismaNetClient vismaNetClient)
{
_vismaNetClient = vismaNetClient;
}
public async Task Test()
{
await _vismaNetClient.RefreshToken();
var inventoryParameters = new Dictionary<string, string>
{
{ "pageSize", "10" }
};
var inventory = await _vismaNetClient.InventoryV3.GetInventoryAsync(inventoryParameters);
}
}
Web Application
Program.cs
using VismaNetCore;
using VismaNetCore.Models.Enums;
var builder = WebApplication.CreateBuilder(args);
// You can also load from appsettings if you fetch that first
builder.Services.AddVismaNetClient(vismaNetOptions => {
vismaNetOptions.GrantType = "client_credentials";
vismaNetOptions.ClientId = "client_id";
vismaNetOptions.ClientSecret = "client_secret";
vismaNetOptions.TenantId = "tenant_id";
vismaNetOptions.Scopes =
[
Scope.ErpServiceCreate,
Scope.ErpServiceDelete,
Scope.ErpServiceRead,
Scope.ErpServiceUpdate,
Scope.SalesOrderRead,
Scope.SalesOrderWrite
];
})
WebApplication app = builder.Build();
app.Run();
Endpoints/Inventory/Get.cs
public class Get
{
private readonly VismaNetClient _vismaNetClient;
public Get(VismaNetClient vismaNetClient)
{
_vismaNetClient = vismaNetClient;
}
public void MapEndpoint(IEndpointRouteBuilder app)
{
app.MapPost("invoices", async (
CreateInvoiceRequest request,
CancellationToken cancellationToken) =>
{
// Get or Refresh the token
await _vismaNetClient.RefreshToken();
var inventory = await _vismaNetClient.InventoryV3.GetInventoryAsync();
return Results.Ok(inventory);
})
.WithTags("Inventory");
}
}
Contributing
Contributions are always welcome!
See CONTRIBUTE.md for ways to get started.
Please adhere to this project's contribution guidelines
.
Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.Options (>= 8.0.2)
- SharedKernel (>= 0.4.0-alpha.168)
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.4.0-alpha.168 | 76 | 8/6/2024 | |
0.4.0-alpha.166 | 49 | 8/6/2024 |