Evolvit.VismaNetCore
0.4.0-alpha.182
Prefix Reserved
This is a prerelease version of Evolvit.VismaNetCore.
dotnet add package Evolvit.VismaNetCore --version 0.4.0-alpha.182
NuGet\Install-Package Evolvit.VismaNetCore -Version 0.4.0-alpha.182
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="Evolvit.VismaNetCore" Version="0.4.0-alpha.182" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Evolvit.VismaNetCore" Version="0.4.0-alpha.182" />
<PackageReference Include="Evolvit.VismaNetCore" />
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 Evolvit.VismaNetCore --version 0.4.0-alpha.182
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Evolvit.VismaNetCore, 0.4.0-alpha.182"
#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 Evolvit.VismaNetCore@0.4.0-alpha.182
#: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=Evolvit.VismaNetCore&version=0.4.0-alpha.182&prerelease
#tool nuget:?package=Evolvit.VismaNetCore&version=0.4.0-alpha.182&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.Options (>= 8.0.2)
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.182 | 71 | 12/11/2024 |
0.4.0-alpha.178 | 76 | 12/10/2024 |
0.4.0-alpha.177 | 80 | 10/3/2024 |
0.4.0-alpha.175 | 70 | 10/3/2024 |
0.4.0-alpha.173 | 68 | 10/3/2024 |