N2C.VismaNET.HttpBase
1.0.4
See the version list below for details.
dotnet add package N2C.VismaNET.HttpBase --version 1.0.4
NuGet\Install-Package N2C.VismaNET.HttpBase -Version 1.0.4
<PackageReference Include="N2C.VismaNET.HttpBase" Version="1.0.4" />
paket add N2C.VismaNET.HttpBase --version 1.0.4
#r "nuget: N2C.VismaNET.HttpBase, 1.0.4"
// Install N2C.VismaNET.HttpBase as a Cake Addin #addin nuget:?package=N2C.VismaNET.HttpBase&version=1.0.4 // Install N2C.VismaNET.HttpBase as a Cake Tool #tool nuget:?package=N2C.VismaNET.HttpBase&version=1.0.4
Http Base
This is a base class for Http requests. It is used by the other Http classes. You need to inherit from this class to be able to use the other classes.
Getting Started
You need to have a valid token to be able to use the API. You can get a token by using the Visma.net API Authentication. You can use the N2C.VismaNET.Token package.
Usage
You need to inherit from this class to be able to use the other classes.
Here is an example of how to implement the ApiBase class in the Get class.
/// <summary>
/// Get is a class for getting employees from the Visma.net API.
/// </summary>
public class Get : ApiBase
{
/// <summary>
/// Get is the constructor for the Get class.
/// </summary>
/// <param name="bearerToken">
/// BearerToken is the bearer token for the Visma.net API.
/// </param>
/// <param name="tenantId">
/// TenantId is the tenant id for the Visma.net API.
/// </param>
public Get(string bearerToken, string tenantId) : base(bearerToken, tenantId)
{
this.Controller = "employee";
}
/// <summary>
/// GetEmployeesAsync gets all employees from the Visma.net API.
/// </summary>
/// <returns></returns>
public async Task<IEnumerable<DTOs.Employee>> GetEmployeesAsync()
{
try
{
var response = await GetAsync<IEnumerable<DTOs.Employee>>(Controller);
return response;
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
throw;
}
}
/// <summary>
/// GetEmployeeAsync gets a single employee from the Visma.net API.
/// </summary>
/// <param name="employeeNumber">
/// EmployeeNumber is the employee number for the employee to get from the Visma.net API.
/// </param>
/// <returns>
/// Returns a single employee from the Visma.net API.
/// </returns>
public async Task<DTOs.Employee> GetEmployeeAsync(string employeeNumber)
{
var response = await GetAsync<DTOs.Employee>($"{Controller}/{employeeNumber}");
return response;
}
}
Version
1.0.4
- Added better error handling for all methods.
- Added xml comment and documentation for all methods.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- No dependencies.
NuGet packages (13)
Showing the top 5 NuGet packages that depend on N2C.VismaNET.HttpBase:
Package | Downloads |
---|---|
N2C.VismaNET.CustomerHandler
Package Description |
|
N2C.VismaNET.ProjectHandler
Package Description |
|
N2C.VismaNET.ProjectTransactionHandler
Machine to Machie integration for Visma NET Project Transaction |
|
N2C.VismaNET.CurrencyRateHandler
Package Description |
|
N2C.VismaNET.CurrencyHandler
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.