This is a work in progress! It is NOT READY for production use. What you are looking at is an ambitious re-write of the most recent fork of this library.
- Upgrading from
RestSharp
105.2.3 -> 110.2.0 - Language update:
>=
C# 8.0 (Haven't decided if we're staying at 8.0) - Updating to V3/V4 API endpoints
- Standardizing model implementations
- Standardizing API calls / method names
- Simplify serialization/deserialization by modifying models to closely resemble HubSpot requests/responses.
- This is a bigger issue than it sounds. With the V3/V4 API, HubSpot's API has become more standardized with respect to the structure of requests and responses, so objects are being refactored to more closely match that structure, which will (hopefully) result in a lot less jiggery-pokery when serializing/deserializing. (see RequestDataConverter.cs for a good example of what I mean -- no disrespect toward the original author(s); earlier versions of HubSpot's API were all over the place; see this for more details.)
- Refactoring existing objects
- Company
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- Model (
- Contacts
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- Model (
- ContactList
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- Model (
- Deal
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- Model (
- EmailSubscription
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- Model (
- Engagement
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- Model (
- Files
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- Model (
- Owner
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- Model (
- Task
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- Model (
- Ticket
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- Model (
- Properties
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- Model (
- Company
- Adding new(-ish) objects; Note: Some of these may have existed in one way or another but were either incomplete
or in need of updating for the V3/V4 API.
- Associations (new-ish)
- Model (
IHubSpotModel
) Interface - ModelList (
IHubSpotModelList
) Interface - Refactor Unit Tests
- Refactor examples
- Comprehensive documentation (XML comments, examples, etc.)
- A word on "types" vs "labels": All of HubSpot's default association types are "unlabeled" types, however you can
create your own custom association types that can be either labeled or unlabeled. A label merely describes the
association. A type represents an association that could exist between two object types. So when creating a
CustomAssociationTypeHubSpotModel
instance, if you do not want it to be labeled, set theLabel
property tonull
. Creating an unlabeled custom association type is analogous to "enabling" an association type from within the Associations tab of an object's settings. Probably the only time you want to do this is when creating an association type between two objects where either one or both of those objects are custom objects.
- Model (
- Refactor Search
-
SearchRequestOptions
interface? - Unit Tests
- Examples
- Comprehensive documentation (XML comments, examples, etc.)
-
- Associations (new-ish)
- Custom object types (TODO list TBD)
- Object Properties/Schema (TODO list TBD)
- Ensure all
DateTime
properties are ISO 8601 formatted (yyyy-MM-ddThh:mm:ss.fffZ
)
C# .NET Wrapper around the common HubSpot APIs:
- Contact
- Company
- Deal
- Engagement
- Owners
- COS Files API (adds the ability to upload files to use as attachments to engagements)
To get started, install the Nuget package and create a instance of HubSpotApi
passing your API Key as the only parameter.
var api = new HubSpotApi("MY API KEY");
// Create a contact
var contact = api.Contact.Create(new ContactHubSpotModel()
{
Email = "[email protected]",
FirstName = "John",
LastName = "Smith",
Phone = "00000 000000",
Company = "Squared Up Ltd."
});
For more examples see the HubSpot.NET.Examples project.
As HubSpot lets you create and add custom properties to your contacts, companies and deals it's likely you'll want to implement your own models. This is straightforward, simply extend the models shipped with this library, e.g. ContactHubSpotModel
and add your own properties. Use the DataMember
attributes to indicate the internal name. For example
public class Contact : ContactHubSpotModel
{
[DataMember(Name = "activities")]
public string Activities { get; set; }
[DataMember(Name = "type")]
public string Type { get; set; }
}
These properties should be of type string
and set as a semicolon delimited list of values, e.g. "value1;value2". This is required by HubSpot, see here for more details.
Please read CONTRIBUTING.md for more information on how to contribute. PRs welcome!
- Dave Clarke
This project is licensed under the MIT License - see the LICENSE file for details
- Initial version based on dotnetcore-hubspot-client by skarpdev, expanded to additional APIs and heavily refactored to use RestSharp etc.