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
7 changes: 5 additions & 2 deletions HubSpot.NET.Tests.Integration/ContactTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ public void Search_5SamplesLimitedTo3WitContinuations_ReturnsCollectionWith3Item
sampleContacts.Add(contact);
}

try
{
// HubSpot is rather slow to update... wait 5 seconds to allow it to catch up
System.Threading.Thread.Sleep(10 * 1000);

try
{
var searchOptions = new ContactSearchRequestOptions
{
Query = "sampledomain.com",
Expand Down
22 changes: 9 additions & 13 deletions HubSpot.NET.Tests.Integration/HubSpot.NET.Tests.Integration.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net9.0</TargetFrameworks>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.8.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.8.3" />
<PackageReference Include="coverlet.collector" Version="6.0.4" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="5.0.0" />
<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.4" />

</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'NET472' ">
Expand All @@ -36,9 +37,4 @@
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>

<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="IF NOT EXIST &quot;$(ProjectDir)app.config&quot; ECHO ^&lt;^?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;^?^&gt;^&lt;configuration^&gt;^&lt;^/configuration^&gt; &gt; &quot;$(ProjectDir)app.config&quot;" />
</Target>

</Project>
3 changes: 2 additions & 1 deletion HubSpot.NET.Tests.Integration/TicketTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;

namespace HubSpot.NET.Tests.Integration
{
Expand Down Expand Up @@ -335,7 +336,7 @@ public void AssociateToContact_TicketIsAssociatedToContact()
{
// Assert
Assert.IsTrue(ticketAssociations.Associations.AssociatedContacts.Any());
Assert.IsNull(ticketAssociations.Associations.AssociatedCompany);
Assert.IsNotNull(ticketAssociations.Associations.AssociatedCompany);
}
finally
{
Expand Down
12 changes: 6 additions & 6 deletions HubSpot.NET/Api/Company/HubSpotCompanyApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public HubSpotCompanyApi(IHubSpotClient client)
{
var path = $"{entity.RouteBasePath}/companies";

return _client.Execute<T>(path, entity, Method.POST, convertToPropertiesSchema: true);
return _client.Execute<T>(path, entity, Method.Post, convertToPropertiesSchema: true);
}

/// <summary>
Expand All @@ -45,7 +45,7 @@ public HubSpotCompanyApi(IHubSpotClient client)

try
{
return _client.Execute<T>(path, Method.GET, convertToPropertiesSchema: true);
return _client.Execute<T>(path, Method.Get, convertToPropertiesSchema: true);
}
catch (HubSpotException exception)
{
Expand All @@ -72,7 +72,7 @@ public HubSpotCompanyApi(IHubSpotClient client)
try
{

CompanySearchResultModel<T> data = _client.ExecuteList<CompanySearchResultModel<T>>(path, options, Method.POST, convertToPropertiesSchema: true);
CompanySearchResultModel<T> data = _client.ExecuteList<CompanySearchResultModel<T>>(path, options, Method.Post, convertToPropertiesSchema: true);

return data;
}
Expand Down Expand Up @@ -116,7 +116,7 @@ public HubSpotCompanyApi(IHubSpotClient client)

var path = $"{entity.RouteBasePath}/companies/{entity.Id}";

T data = _client.Execute<T>(path, entity, Method.PUT, convertToPropertiesSchema: true);
T data = _client.Execute<T>(path, entity, Method.Put, convertToPropertiesSchema: true);

return data;
}
Expand All @@ -129,7 +129,7 @@ public void Delete(long companyId)
{
var path = $"{new CompanyHubSpotModel().RouteBasePath}/companies/{companyId}";

_client.Execute(path, method: Method.DELETE, convertToPropertiesSchema: true);
_client.Execute(path, method: Method.Delete, convertToPropertiesSchema: true);
}

public CompanySearchHubSpotModel<T> Search<T>(SearchRequestOptions opts = null) where T : CompanyHubSpotModel, new()
Expand All @@ -139,7 +139,7 @@ public void Delete(long companyId)

var path = "/crm/v3/objects/companies/search";

CompanySearchHubSpotModel<T> data = _client.ExecuteList<CompanySearchHubSpotModel<T>>(path, opts, Method.POST, convertToPropertiesSchema: true);
CompanySearchHubSpotModel<T> data = _client.ExecuteList<CompanySearchHubSpotModel<T>>(path, opts, Method.Post, convertToPropertiesSchema: true);

return data;
}
Expand Down
16 changes: 8 additions & 8 deletions HubSpot.NET/Api/Contact/HubSpotContactApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public HubSpotContactApi(IHubSpotClient client)
public T Create<T>(T entity) where T : ContactHubSpotModel, new()
{
var path = $"{entity.RouteBasePath}/contact";
return _client.Execute<T>(path, entity, Method.POST, convertToPropertiesSchema: true);
return _client.Execute<T>(path, entity, Method.Post, convertToPropertiesSchema: true);
}

/// <summary>
Expand All @@ -43,7 +43,7 @@ public HubSpotContactApi(IHubSpotClient client)
public T CreateOrUpdate<T>(T entity) where T : ContactHubSpotModel, new()
{
var path = $"{entity.RouteBasePath}/contact/createOrUpdate/email/{entity.Email}/";
return _client.Execute<T>(path, entity, Method.POST, convertToPropertiesSchema: true);
return _client.Execute<T>(path, entity, Method.Post, convertToPropertiesSchema: true);
}

/// <summary>
Expand All @@ -58,7 +58,7 @@ public HubSpotContactApi(IHubSpotClient client)

try
{
T data = _client.Execute<T>(path, Method.GET, convertToPropertiesSchema: true);
T data = _client.Execute<T>(path, Method.Get, convertToPropertiesSchema: true);
return data;
}
catch (HubSpotException exception)
Expand All @@ -81,7 +81,7 @@ public HubSpotContactApi(IHubSpotClient client)

try
{
T data = _client.Execute<T>(path, Method.GET, convertToPropertiesSchema: true);
T data = _client.Execute<T>(path, Method.Get, convertToPropertiesSchema: true);
return data;
}
catch (HubSpotException exception)
Expand All @@ -104,7 +104,7 @@ public HubSpotContactApi(IHubSpotClient client)

try
{
T data = _client.Execute<T>(path, Method.GET, convertToPropertiesSchema: true);
T data = _client.Execute<T>(path, Method.Get, convertToPropertiesSchema: true);
return data;
}
catch (HubSpotException exception)
Expand Down Expand Up @@ -153,7 +153,7 @@ public HubSpotContactApi(IHubSpotClient client)

var path = $"{contact.RouteBasePath}/contact/vid/{contact.Id}/profile";

_client.Execute(path, contact, Method.POST, convertToPropertiesSchema: true);
_client.Execute(path, contact, Method.Post, convertToPropertiesSchema: true);
}

/// <summary>
Expand All @@ -164,7 +164,7 @@ public void Delete(long contactId)
{
var path = $"{new ContactHubSpotModel().RouteBasePath}/contact/vid/{contactId}";

_client.Execute(path, method: Method.DELETE, convertToPropertiesSchema: true);
_client.Execute(path, method: Method.Delete, convertToPropertiesSchema: true);
}

/// <summary>
Expand All @@ -177,7 +177,7 @@ public void Delete(long contactId)
{
var path = $"{new T().RouteBasePath}/contact/batch";

_client.ExecuteBatch(path, contacts.Select(c => (object) c).ToList(), Method.POST, convertToPropertiesSchema: true);
_client.ExecuteBatch(path, contacts.Select(c => (object) c).ToList(), Method.Post, convertToPropertiesSchema: true);
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions HubSpot.NET/Api/ContactList/HubSpotContactListApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public ContactListUpdateResponseModel AddContactsToList(long listId, IEnumerable
var model = new ContactListUpdateModel();
var path = $"{model.RouteBasePath}/{listId}/add";
model.ContactIds.AddRange(contactIds);
var data = _client.Execute<ContactListUpdateResponseModel>(path, model, Method.POST, convertToPropertiesSchema: false);
var data = _client.Execute<ContactListUpdateResponseModel>(path, model, Method.Post, convertToPropertiesSchema: false);

return data;
}
Expand All @@ -113,7 +113,7 @@ public ContactListUpdateResponseModel RemoveContactsFromList(long listId, IEnume
var model = new ContactListUpdateModel();
var path = $"{model.RouteBasePath}/{listId}/remove";
model.ContactIds.AddRange(contactIds);
var data = _client.Execute<ContactListUpdateResponseModel>(path, model, Method.POST, convertToPropertiesSchema: false);
var data = _client.Execute<ContactListUpdateResponseModel>(path, model, Method.Post, convertToPropertiesSchema: false);

return data;
}
Expand All @@ -125,7 +125,7 @@ public ContactListUpdateResponseModel RemoveContactsFromList(long listId, IEnume
public void DeleteContactList(long listId)
{
var path = $"{new ContactListModel().RouteBasePath}/{listId}";
_client.Execute(path, method: Method.DELETE, convertToPropertiesSchema: true);
_client.Execute(path, method: Method.Delete, convertToPropertiesSchema: true);
}

/// <summary>
Expand All @@ -141,7 +141,7 @@ public ContactListModel CreateStaticContactList(string contactListName )
Dynamic = false
};
var path = $"{model.RouteBasePath}";
var data = _client.Execute<ContactListModel>(path, model, Method.POST, convertToPropertiesSchema: false);
var data = _client.Execute<ContactListModel>(path, model, Method.Post, convertToPropertiesSchema: false);
return data;
}
}
Expand Down
14 changes: 7 additions & 7 deletions HubSpot.NET/Api/Deal/HubSpotDealApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public HubSpotDealApi(IHubSpotClient client)
public T Create<T>(T entity) where T : DealHubSpotModel, new()
{
var path = $"{entity.RouteBasePath}/deal";
var data = _client.Execute<T>(path, entity, Method.POST, convertToPropertiesSchema: true);
var data = _client.Execute<T>(path, entity, Method.Post, convertToPropertiesSchema: true);
return data;
}

Expand All @@ -44,7 +44,7 @@ public HubSpotDealApi(IHubSpotClient client)

try
{
var data = _client.Execute<T>(path, Method.GET, convertToPropertiesSchema: true);
var data = _client.Execute<T>(path, Method.Get, convertToPropertiesSchema: true);
return data;
}
catch (HubSpotException exception)
Expand All @@ -68,7 +68,7 @@ public HubSpotDealApi(IHubSpotClient client)

var path = $"{entity.RouteBasePath}/deal/{entity.Id}";

var data = _client.Execute<T>(path, entity, method: Method.PUT, convertToPropertiesSchema: true);
var data = _client.Execute<T>(path, entity, method: Method.Put, convertToPropertiesSchema: true);
return data;
}

Expand Down Expand Up @@ -140,7 +140,7 @@ public void Delete(long dealId)
{
var path = $"{new DealHubSpotModel().RouteBasePath}/deal/{dealId}";

_client.Execute(path, method: Method.DELETE, convertToPropertiesSchema: true);
_client.Execute(path, method: Method.Delete, convertToPropertiesSchema: true);
}

/// <summary>
Expand Down Expand Up @@ -213,7 +213,7 @@ public void Delete(long dealId)

var path = "/crm/v3/objects/deals/search";

var data = _client.ExecuteList<SearchHubSpotModel<T>>(path, opts, Method.POST, convertToPropertiesSchema: true);
var data = _client.ExecuteList<SearchHubSpotModel<T>>(path, opts, Method.Post, convertToPropertiesSchema: true);

return data;
}
Expand All @@ -234,7 +234,7 @@ public void Delete(long dealId)
toObjectId = companyId,
category = "HUBSPOT_DEFINED",
definitionId = 5 // see https://legacydocs.hubspot.com/docs/methods/crm-associations/crm-associations-overview
}, method: Method.PUT, convertToPropertiesSchema: true);
}, method: Method.Put, convertToPropertiesSchema: true);
entity.Associations.AssociatedCompany = new[] { companyId };
return entity;
}
Expand All @@ -255,7 +255,7 @@ public void Delete(long dealId)
toObjectId = contactId,
category = "HUBSPOT_DEFINED",
definitionId = 3 // see https://legacydocs.hubspot.com/docs/methods/crm-associations/crm-associations-overview
}, method: Method.PUT, convertToPropertiesSchema: true);
}, method: Method.Put, convertToPropertiesSchema: true);
entity.Associations.AssociatedContacts = new[] { contactId };
return entity;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public SubscriptionStatusHubSpotModel GetStatus(string email)
{
var path = $"{new SubscriptionTypeListHubSpotModel().RouteBasePath}/subscriptions/{email}";

return _client.Execute<SubscriptionStatusHubSpotModel>(path, Method.GET, false);
return _client.Execute<SubscriptionStatusHubSpotModel>(path, Method.Get, false);
}


Expand All @@ -56,7 +56,7 @@ public void UnsubscribeAll(string email)
{
var path = $"{new SubscriptionTypeListHubSpotModel().RouteBasePath}/subscriptions/{email}";

_client.Execute(path, new { unsubscribeFromAll = true }, Method.PUT, false);
_client.Execute(path, new { unsubscribeFromAll = true }, Method.Put, false);
}

/// <summary>
Expand All @@ -81,7 +81,7 @@ public void UnsubscribeFrom(string email, long id)
}
};

_client.Execute(path, model, Method.PUT, false);
_client.Execute(path, model, Method.Put, false);
}


Expand Down Expand Up @@ -133,7 +133,7 @@ public void SubscribeTo(string email, long id, string basis, string basisExplana

var path = $"{model.RouteBasePath}/{email}";

_client.Execute(path, model, Method.PUT, false);
_client.Execute(path, model, Method.Put, false);
}
}
}
10 changes: 5 additions & 5 deletions HubSpot.NET/Api/Engagement/HubSpotEngagementApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public HubSpotEngagementApi(IHubSpotClient client)
public EngagementHubSpotModel Create(EngagementHubSpotModel entity)
{
var path = $"{entity.RouteBasePath}/engagements";
var data = _client.Execute<EngagementHubSpotModel>(path, entity, Method.POST, false);
var data = _client.Execute<EngagementHubSpotModel>(path, entity, Method.Post, false);
return data;
}

Expand All @@ -42,7 +42,7 @@ public void Update(EngagementHubSpotModel entity)

var path = $"{entity.RouteBasePath}/engagements/{entity.Engagement.Id}";

_client.Execute(path, entity, Method.PATCH, false);
_client.Execute(path, entity, Method.Patch, false);
}

/// <summary>
Expand All @@ -56,7 +56,7 @@ public EngagementHubSpotModel GetById(long engagementId)

try
{
var data = _client.Execute<EngagementHubSpotModel>(path, Method.GET, false);
var data = _client.Execute<EngagementHubSpotModel>(path, Method.Get, false);
return data;
}
catch (HubSpotException exception)
Expand Down Expand Up @@ -120,7 +120,7 @@ public void Delete(long engagementId)
{
var path = $"{new EngagementHubSpotModel().RouteBasePath}/engagements/{engagementId}";

_client.Execute(path, method: Method.DELETE, convertToPropertiesSchema: true);
_client.Execute(path, method: Method.Delete, convertToPropertiesSchema: true);
}

/// <summary>
Expand All @@ -133,7 +133,7 @@ public void Associate(long engagementId, string objectType, long objectId)
{
var path = $"{new EngagementHubSpotModel().RouteBasePath}/engagements/{engagementId}/associations/{objectType}/{objectId}";

_client.Execute(path, method: Method.PUT, convertToPropertiesSchema: true);
_client.Execute(path, method: Method.Put, convertToPropertiesSchema: true);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion HubSpot.NET/Api/Files/HubSpotCosFileApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public HubSpotCosFileApi(IHubSpotClient client)
public FolderHubSpotModel CreateFolder(FolderHubSpotModel folder)
{
var path = $"{new FolderHubSpotModel().RouteBasePath}/folders";
return _client.Execute<FolderHubSpotModel>(path, folder, Method.POST, false);
return _client.Execute<FolderHubSpotModel>(path, folder, Method.Post, false);
}


Expand Down
Loading