Skip to content

Commit

Permalink
0.6.19.7 Added date created and date updated properties to the Compan…
Browse files Browse the repository at this point in the history
…y model. Patched contact search.
  • Loading branch information
cdmdotnet committed Apr 22, 2021
1 parent b06072c commit b6babde
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 5 deletions.
9 changes: 8 additions & 1 deletion HubSpot.NET/Api/Company/Dto/CompanyHubSpotModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Runtime.Serialization;
using System;
using System.Runtime.Serialization;
using HubSpot.NET.Core.Interfaces;

namespace HubSpot.NET.Api.Company.Dto
Expand Down Expand Up @@ -35,6 +36,12 @@ public CompanyHubSpotModel()
[DataMember(Name = "country")]
public string Country { get; set; }

[DataMember(Name = "createdAt")]
public DateTime? CreatedAt { get; set; }

[DataMember(Name = "updatedAt")]
public DateTime? UpdatedAt { get; set; }

public string RouteBasePath => "/companies/v2";
public bool IsNameValue => true;

Expand Down
9 changes: 8 additions & 1 deletion HubSpot.NET/Api/Contact/Dto/ContactHubSpotModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Runtime.Serialization;
using System;
using System.Runtime.Serialization;
using HubSpot.NET.Core.Interfaces;

namespace HubSpot.NET.Api.Contact.Dto
Expand Down Expand Up @@ -44,6 +45,12 @@ public class ContactHubSpotModel : IHubSpotModel
[DataMember(Name="hubspot_owner_id")]
public long? OwnerId { get;set; }

[DataMember(Name = "createdAt")]
public DateTime? CreatedAt { get; set; }

[DataMember(Name = "updatedAt")]
public DateTime? UpdatedAt { get; set; }

public string RouteBasePath => "/contacts/v1";
public bool IsNameValue => false;
public virtual void ToHubSpotDataEntity(ref dynamic converted)
Expand Down
2 changes: 1 addition & 1 deletion HubSpot.NET/Api/Contact/HubSpotContactApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public void Delete(long contactId)
path = path.SetQueryParam("offset", opts.Offset);
}

var data = _client.ExecuteList<ContactSearchHubSpotModel<T>>(path, opts);
var data = _client.ExecuteList<ContactSearchHubSpotModel<T>>(path);

return data;
}
Expand Down
9 changes: 8 additions & 1 deletion HubSpot.NET/Api/Deal/Dto/DealHubSpotModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using HubSpot.NET.Core.Interfaces;
Expand Down Expand Up @@ -46,6 +47,12 @@ public DealHubSpotModel()
[DataMember(Name = "dealtype")]
public string DealType { get; set; }

[DataMember(Name = "createdAt")]
public DateTime? CreatedAt { get; set; }

[DataMember(Name = "updatedAt")]
public DateTime? UpdatedAt { get; set; }

[IgnoreDataMember]
public DealHubSpotAssociations Associations { get; }

Expand Down
15 changes: 15 additions & 0 deletions HubSpot.NET/Core/Requests/RequestDataConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,21 @@ internal object ConvertSingleEntity(ExpandoObject dynamicObject, object dto)
companyIdProp?.SetValue(dto, companyIdValue);
}

// DateCreated
if (expandoDict.TryGetValue("createdAt", out var createdAtData))
{
// TODO use properly serialized name of prop to find it
var createdAtProp = dtoProps.SingleOrDefault(q => q.GetPropSerializedName() == "createdAt");
createdAtProp?.SetValue(dto, createdAtData);
}
// DateUpdated
if (expandoDict.TryGetValue("updatedAt", out var updatedAtData))
{
// TODO use properly serialized name of prop to find it
var updatedAtProp = dtoProps.SingleOrDefault(q => q.GetPropSerializedName() == "updatedAt");
updatedAtProp?.SetValue(dto, updatedAtData);
}

// The Properties object in the json / response data contains all the props we wish to map - if that does not exist
// we cannot proceeed
if (!expandoDict.TryGetValue("properties", out var dynamicProperties)) return dto;
Expand Down
4 changes: 3 additions & 1 deletion HubSpot.NET/HubSpot.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net46;net451;netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.6.19.6</Version>
<Version>0.6.19.7</Version>
<Authors>cdmdotnet Limited - originally Squared Up Ltd.</Authors>
<Company>cdmdotnet Limited - originally Squared Up Ltd.</Company>
<Description>C# .NET Wrapper around the common HubSpot APIs. This is a fork/continuation of the original project that now appears not to be maintained.</Description>
Expand All @@ -15,6 +15,8 @@
<RepositoryUrl>https://github.com/Chinchilla-Software-Com/HubSpot.NET</RepositoryUrl>
<PackageTags>hubspot api wrapper c# contact company deal engagement properties crm</PackageTags>
<PackageReleaseNotes>
0.6.19.7 Added date created and date updated properties to the Company model. Patched contact search.

0.6.19.6 Patched handling for nullable boolean properties.

0.6.19.5 Added the ability to get all contact and deal associations for a company.
Expand Down

0 comments on commit b6babde

Please sign in to comment.