N2C.VismaNET.HttpBase 1.0.4

There is a newer version of this package available.
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                
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="N2C.VismaNET.HttpBase" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add N2C.VismaNET.HttpBase --version 1.0.4                
#r "nuget: N2C.VismaNET.HttpBase, 1.0.4"                
#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.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last updated
1.0.5 154 5/23/2024
1.0.4 195 1/31/2024
1.0.3 91 5/23/2024
1.0.2 490 2/15/2023
1.0.1 245 2/15/2023
1.0.0 472 1/30/2023