https://github.com/devpro/hubspot-dotnet
.NET Core wrappers for the HubSpot REST API
https://github.com/devpro/hubspot-dotnet
api-client dotnet dotnet-core dotnet-standard hubspot
Last synced: 6 months ago
JSON representation
.NET Core wrappers for the HubSpot REST API
- Host: GitHub
- URL: https://github.com/devpro/hubspot-dotnet
- Owner: devpro
- License: apache-2.0
- Created: 2020-03-10T16:55:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-12T04:04:33.000Z (almost 3 years ago)
- Last Synced: 2025-04-23T11:41:13.960Z (6 months ago)
- Topics: api-client, dotnet, dotnet-core, dotnet-standard, hubspot
- Language: C#
- Size: 710 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HubSpot .NET
[](https://dev.azure.com/devprofr/open-source/_build/latest?definitionId=37&branchName=master)
[](https://sonarcloud.io/dashboard?id=devpro.hubspot.dotnet)
[](https://sonarcloud.io/dashboard?id=devpro.hubspot.dotnet).NET Core wrappers for the [HubSpot](https://www.hubspot.com/) API.
Package | Version | Type
------- | ------- | ----
`Devpro.Hubspot.Abstractions` | [](https://www.nuget.org/packages/Devpro.Hubspot.Abstractions/) | .NET Standard 2.1
`Devpro.Hubspot.Client` | [](https://www.nuget.org/packages/Devpro.Hubspot.Client/) | .NET Standard 2.1## Requirements
- Have an HubSpot developer account ([create one](https://developers.hubspot.com/))
## How to use
- Have the [NuGet package](https://www.nuget.org/packages/Devpro.Hubspot.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 DefaultHubspotClientConfiguration
using Devpro.Hubspot.Client;public class AppConfiguration : IHubspotClientConfiguration
{
// explicitely choose where to take the configuration for Hubspot 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.Hubspot.Client.DependencyInjection;var services = new ServiceCollection()
.AddHubspotClient(Configuration);
```- Use the repositories (enjoy a simple, yet optimized, HTTP client)
```csharp
using Devpro.Hubspot.Abstractions;private readonly IContactRepository _contactRepository;
public MyService(IContactRepository contactRepository)
{
_contactRepository = contactRepository;
}public async Task GetContacts()
{
var contacts = await _contactRepository.FindAllAsync();
}
```## How to build
Once the git repository has been cloned, execute the following commands from the root directory:
```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
xxx
```
And execute all tests (unit and integration ones):
```bash
dotnet test --settings Local.runsettings
```## References
- [HubSpot API Overview](https://developers.hubspot.com/docs/overview)
- [adimichele/hubspot-ruby](https://github.com/adimichele/hubspot-ruby)
- [HubSpot/hubspot-php](https://github.com/HubSpot/hubspot-php)
- [hubspot-net/HubSpot.NET](https://github.com/hubspot-net/HubSpot.NET): outdated .NET client, no recent CI with code coverage, not compatible with dependency injection and not using .NET best practices (HTTP client, naming convention, clean code, editorconfig)