Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/devpro/2hire-dotnet-client

.NET client for 2hire.io solution to manage a fleet of connected vehicles
https://github.com/devpro/2hire-dotnet-client

2hire connected-vehicle dotnet-core iot

Last synced: 2 days ago
JSON representation

.NET client for 2hire.io solution to manage a fleet of connected vehicles

Awesome Lists containing this project

README

        

# 2hire .NET Client

[![Build Status](https://dev.azure.com/devprofr/open-source/_apis/build/status/libraries/2hire-dotnet-client-ci?branchName=master)](https://dev.azure.com/devprofr/open-source/_build/latest?definitionId=33&branchName=master)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=devpro.2hire.dotnetclient&metric=alert_status)](https://sonarcloud.io/dashboard?id=devpro.2hire.dotnetclient)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=devpro.2hire.dotnetclient&metric=coverage)](https://sonarcloud.io/dashboard?id=devpro.2hire.dotnetclient)

.NET client for [2hire.io](https://2hire.io/) solution to manage a fleet of connected vehicles.

Package | Version | Type
------- | ------- | ----
`Devpro.Twohire.Abstractions` | [![Version](https://img.shields.io/nuget/v/Devpro.Twohire.Abstractions.svg)](https://www.nuget.org/packages/Devpro.Twohire.Abstractions/) | .NET Standard 2.1
`Devpro.Twohire.Client` | [![Version](https://img.shields.io/nuget/v/Devpro.Twohire.Client.svg)](https://www.nuget.org/packages/Devpro.Twohire.Client/) | .NET Standard 2.1

## How to use

- Have the [NuGet package](https://www.nuget.org/packages/Devpro.Twohire.Client) in your csproj file (can be done manually, with Visual Studio or through nuget command)

```xml



```

- Make the code changes to be able to use the library (config & service provider)

```csharp
// implement the configuration interface (for instance in a configuration class in your app project) or use DefaultTwohireClientConfiguration
using Devpro.Twohire.Client;

public class AppConfiguration : ITwohireClientConfiguration
{
// explicitely choose where to take the configuration for 2hire REST API (this is the responibility of the app, not the library)
}

// configure your service provider (for instance in your app Startup class)
using Devpro.Twohire.Client.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection()
.AddLogging()
.AddTwohireClient(Configuration);
```

- Use the repositories (enjoy a simple, yet optimized, HTTP client)

```csharp
using Devpro.Twohire.Abstractions.Repositories;

private readonly IPersonalVehicleRepository _personalVehicleRepository;

public MyService(IPersonalVehicleRepository personalVehicleRepository)
{
_personalVehicleRepository = personalVehicleRepository;
}

public async Task GetVehicles()
{
var vehicles = await _personalVehicleRepository.FindAllAsync();
}
```

## How to build

```bash
dotnet restore
dotnet build
```

## How to test

For integration tests, to manage the configuration (secrets) you can create a file at the root directory called `Local.runsettings` or define them as environment variables:

```xml



xxx
xxx
xxx
xxx
xxx

```

And execute all tests (unit and integration ones):

```bash
dotnet test --settings Local.runsettings
```