Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion HubSpot.NET/Api/Engagement/Dto/EngagementHubSpotModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class EngagementHubSpotAssociationsModel
public class EngagementHubSpotEngagementModel
{
[DataMember(Name = "id")]
public long? Id { get; set; }
public long Id { get; set; }

[DataMember(Name = "type")]
public string Type { get;set; }
Expand Down
14 changes: 10 additions & 4 deletions HubSpot.NET/Core/HubSpotBaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace HubSpot.NET.Core
using HubSpot.NET.Core.Interfaces;
using HubSpot.NET.Core.Serializers;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using RestSharp;
using System.Collections.Generic;

Expand Down Expand Up @@ -110,9 +111,15 @@ public void UpdateToken(HubSpotToken token)
private T SendReceiveRequest<T,K>(string path, Method method, K entity) where T: new()
{
RestRequest request = ConfigureRequestAuthentication(path, method);

if(!entity.Equals(default(K)))
request.AddJsonBody(entity);

var json = JsonConvert.SerializeObject(entity, new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore
});

if (!entity.Equals(default(K)))
request.AddJsonBody(json);

IRestResponse response = _client.Execute(request);

Expand Down Expand Up @@ -179,7 +186,6 @@ private RestRequest ConfigureRequestAuthentication(string path, Method method)
break;
}

request.JsonSerializer = new NewtonsoftRestSharpSerializer();
return request;
}

Expand Down