Connectors
This library is based on connectors.
A connector exposes a friendlier API that can be used to interact with their specific type, regardles of the underlying implementation.
For example, the IHubSpotCompanyConnector supports the possibility to retrieve all the companies matching a certain criteria ignoring the underlying paging system.
var connector = serviceProvider.GetRequiredService<IHubSpotCompanyConnector>();
var companies = await connector.FindAsync(FilterCompanies.ByDomain("educations.com"));
foreach (var company in companies)
{
DoSomethingWithCompany(company);
}Currently there are three connectors:
IHubSpotCompanyConnectorcan be used to interact with companiesIHubSpotContactConnectorcan be used to interact with contactsIHubSpotDealConnectorcan be used to interact with deals
Each connector needs to be registered independently.
services.AddHubSpot(hs => hs
.UseOAuthAuthentication(configuration.GetSection("HubSpot"))
.UseCompanyConnector()
.UseContactConnector()
.UseDealConnector());Customized entities
The entities exposed by connectors can be expanded via subclassing to add custom properties
For example, in the snippet below we are creating a CustomDeal type so that we can add our own property.
When using the connector, the library will take care of serializing the value of the InternalId property into a custom property named internal_id. Or, viceversa, it will request the field and deserialize it into the property of the object.
Last updated
Was this helpful?