diff --git a/HubSpot.NET.Examples/Contacts.cs b/HubSpot.NET.Examples/Contacts.cs index 2865baa1..188822d8 100644 --- a/HubSpot.NET.Examples/Contacts.cs +++ b/HubSpot.NET.Examples/Contacts.cs @@ -80,9 +80,15 @@ public static void Example() api.Contact.Delete(contact.Id.Value); /** - * Get all contacts + * Get all contacts with specific properties + * By default only a few properties are returned */ - var contacts = api.Contact.List(); + var contacts = api.Contact.List(new List + { + "firstname", + "lastname", + "email" + }); } } } diff --git a/HubSpot.NET/Api/Contact/HubSpotContactApi.cs b/HubSpot.NET/Api/Contact/HubSpotContactApi.cs index 95944805..04d72871 100644 --- a/HubSpot.NET/Api/Contact/HubSpotContactApi.cs +++ b/HubSpot.NET/Api/Contact/HubSpotContactApi.cs @@ -60,10 +60,11 @@ public HubSpotContactApi(IHubSpotClient client) /// /// List all available contacts /// + /// List of properties to fetch for each contact /// Request options - used for pagination etc. /// Implementation of ContactHubSpotModel /// A list of contacts - public T List(ListRequestOptions opts = null) where T : ContactListHubSpotModel, new() + public T List(List properties, ListRequestOptions opts = null) where T : ContactListHubSpotModel, new() { if (opts == null) { @@ -78,6 +79,11 @@ public HubSpotContactApi(IHubSpotClient client) path = path.SetQueryParam("vidOffset", opts.Offset); } + if (properties != null && properties.Any()) + { + path = path.SetQueryParam("property", properties); + } + var data = _client.ExecuteList(path, opts); return data; diff --git a/HubSpot.NET/Core/Interfaces/IHubSpotContactApi.cs b/HubSpot.NET/Core/Interfaces/IHubSpotContactApi.cs index 3f9302ce..213f7ed5 100644 --- a/HubSpot.NET/Core/Interfaces/IHubSpotContactApi.cs +++ b/HubSpot.NET/Core/Interfaces/IHubSpotContactApi.cs @@ -11,7 +11,7 @@ public interface IHubSpotContactApi void Batch(List entities) where T : ContactHubSpotModel, new(); T GetByEmail(string email) where T : ContactHubSpotModel, new(); T GetById(long contactId) where T : ContactHubSpotModel, new(); - T List(ListRequestOptions opts = null) where T : ContactListHubSpotModel, new(); + T List(List properties, ListRequestOptions opts = null) where T : ContactListHubSpotModel, new(); void Update(T contact) where T : ContactHubSpotModel, new(); } } \ No newline at end of file diff --git a/HubSpot.NET/HubSpot.NET.csproj b/HubSpot.NET/HubSpot.NET.csproj index 5c746b8d..b21625d3 100644 --- a/HubSpot.NET/HubSpot.NET.csproj +++ b/HubSpot.NET/HubSpot.NET.csproj @@ -3,7 +3,7 @@ net46;net451 true - 0.5.0 + 0.5.1 Squared Up Ltd. Squared Up Ltd. C# .NET Wrapper around the common HubSpot APIs. @@ -12,7 +12,7 @@ https://github.com/squaredup/HubSpot.NET https://github.com/squaredup/HubSpot.NET hubspot api wrapper c# contact company deal engagement properties crm - 0.5 + 0.5.1 SquaredUp.HubSpot.NET