From 2803a931932dfd3a52076edfca81378da9fe9d88 Mon Sep 17 00:00:00 2001 From: radek-petrik-se <57619532+radek-petrik-se@users.noreply.github.com> Date: Wed, 25 Nov 2020 19:10:54 +0100 Subject: [PATCH] Revert "Removes Flurl dependency" --- HubSpot.NET/Api/Company/HubSpotCompanyApi.cs | 13 ++- HubSpot.NET/Api/Contact/HubSpotContactApi.cs | 65 +++++++------- HubSpot.NET/Api/Deal/HubSpotDealApi.cs | 87 +++++++++---------- .../Api/EmailEvents/HubSpotEmailEventsApi.cs | 27 +++--- .../Api/Engagement/HubSpotEngagementApi.cs | 21 ++--- .../Api/Pipeline/HubSpotPipelinesApi.cs | 6 +- HubSpot.NET/Core/Abstracts/ApiRoutable.cs | 5 +- HubSpot.NET/Core/HubSpotBaseClient.cs | 3 +- HubSpot.NET/Core/Interfaces/IHubSpotClient.cs | 1 + HubSpot.NET/HubSpot.NET.csproj | 1 + 10 files changed, 119 insertions(+), 110 deletions(-) diff --git a/HubSpot.NET/Api/Company/HubSpotCompanyApi.cs b/HubSpot.NET/Api/Company/HubSpotCompanyApi.cs index 78139306..978325f1 100644 --- a/HubSpot.NET/Api/Company/HubSpotCompanyApi.cs +++ b/HubSpot.NET/Api/Company/HubSpotCompanyApi.cs @@ -1,5 +1,6 @@ namespace HubSpot.NET.Api.Company { + using Flurl; using HubSpot.NET.Api.Company.Dto; using HubSpot.NET.Core; using HubSpot.NET.Core.Abstracts; @@ -7,9 +8,9 @@ namespace HubSpot.NET.Api.Company using RestSharp; using System; using System.Linq; - using System.Net; + using System.Net; - public class HubSpotCompanyApi : ApiRoutable, IHubSpotCompanyApi + public class HubSpotCompanyApi : ApiRoutable, IHubSpotCompanyApi { private readonly IHubSpotClient _client; public override string MidRoute => "/companies/v2"; @@ -78,15 +79,13 @@ public CompanyListHubSpotModel List(ListRequestOptions opts { opts = opts ?? new ListRequestOptions(); - string path = GetRoute("companies", "paged"); - - path += $"{QueryParams.COUNT}={opts.Limit}"; + var path = GetRoute("companies", "paged").SetQueryParam(QueryParams.COUNT, opts.Limit); if (opts.PropertiesToInclude.Any()) - path += $"{QueryParams.PROPERTIES}={opts.PropertiesToInclude}"; + path.SetQueryParam(QueryParams.PROPERTIES, opts.PropertiesToInclude); if (opts.Offset.HasValue) - path += $"{QueryParams.OFFSET}={opts.Offset}"; + path = path.SetQueryParam(QueryParams.OFFSET, opts.Offset); return _client.Execute, ListRequestOptions>(path, opts); } diff --git a/HubSpot.NET/Api/Contact/HubSpotContactApi.cs b/HubSpot.NET/Api/Contact/HubSpotContactApi.cs index 5fab23da..6a920ad0 100644 --- a/HubSpot.NET/Api/Contact/HubSpotContactApi.cs +++ b/HubSpot.NET/Api/Contact/HubSpotContactApi.cs @@ -3,7 +3,8 @@ using System; using System.Collections.Generic; using System.Linq; - using System.Net; + using System.Net; + using Flurl; using HubSpot.NET.Api.Contact.Dto; using HubSpot.NET.Core; using HubSpot.NET.Core.Abstracts; @@ -155,17 +156,16 @@ public ContactHubSpotModel GetByUserToken(string userToken, bool IncludeHistory /// A list of contacts public ContactListHubSpotModel List(ListRequestOptions opts = null) { - opts = opts ?? new ListRequestOptions(); + opts = opts ?? new ListRequestOptions(); - string path = GetRoute("lists", "all", "contacts", "all"); - - path += $"{QueryParams.COUNT}={opts.Limit}"; + var path = GetRoute("lists", "all", "contacts","all") + .SetQueryParam(QueryParams.COUNT, opts.Limit); if (opts.PropertiesToInclude.Any()) - path += $"{QueryParams.PROPERTY}={opts.PropertiesToInclude}"; + path.SetQueryParam(QueryParams.PROPERTY, opts.PropertiesToInclude); if (opts.Offset.HasValue) - path = path += $"{QueryParams.VID_OFFSET}={opts.Offset}"; + path = path.SetQueryParam(QueryParams.VID_OFFSET, opts.Offset); return _client.Execute, ListRequestOptions>(path, opts); } @@ -209,22 +209,21 @@ public ContactListHubSpotModel RecentlyUpdated(ListRecentRe { opts = opts ?? new ListRecentRequestOptions(); - string path = GetRoute("lists", "recently_updated", "contacts", "recent"); - - path += $"?{QueryParams.COUNT}={opts.Limit}"; + Url path = GetRoute("lists", "recently_updated","contacts","recent") + .SetQueryParam("count", opts.Limit); if (opts.PropertiesToInclude.Any()) - path += $"{QueryParams.PROPERTY}={opts.PropertiesToInclude}"; + path.SetQueryParam(QueryParams.PROPERTY, opts.PropertiesToInclude); if (opts.Offset.HasValue) - path += $"{QueryParams.VID_OFFSET}={opts.Offset}"; + path = path.SetQueryParam(QueryParams.VID_OFFSET, opts.Offset); if (!string.IsNullOrEmpty(opts.TimeOffset)) - path += $"{QueryParams.TIME_OFFSET}={opts.TimeOffset}"; + path = path.SetQueryParam(QueryParams.TIME_OFFSET, opts.TimeOffset); - path += $"{QueryParams.PROPERTY_MODE}={opts.PropertyMode}" + - $"&{QueryParams.FORM_SUBMISSION_MODE}={opts.FormSubmissionMode}" + - $"&{QueryParams.SHOW_LIST_MEMBERSHIPS}={opts.ShowListMemberships}"; + path = path.SetQueryParam(QueryParams.PROPERTY_MODE, opts.PropertyMode) + .SetQueryParam(QueryParams.FORM_SUBMISSION_MODE, opts.FormSubmissionMode) + .SetQueryParam(QueryParams.SHOW_LIST_MEMBERSHIPS, opts.ShowListMemberships); return _client.Execute, ListRecentRequestOptions>(path, opts); } @@ -233,16 +232,16 @@ public ContactSearchHubSpotModel Search(ContactSearchReques { opts = opts ?? new ContactSearchRequestOptions(); - string path = GetRoute("search", "query"); - - path += $"q={opts.Query}&{QueryParams.COUNT}={opts.Limit}"; + Url path = GetRoute("search","query") + .SetQueryParam("q", opts.Query) + .SetQueryParam(QueryParams.COUNT, opts.Limit); if (opts.PropertiesToInclude.Any()) - path += $"{QueryParams.PROPERTY}={opts.PropertiesToInclude}"; + path.SetQueryParam(QueryParams.PROPERTY, opts.PropertiesToInclude); if (opts.Offset.HasValue) - path = path += $"{QueryParams.OFFSET}={opts.Offset}"; + path = path.SetQueryParam(QueryParams.OFFSET, opts.Offset); return _client.Execute, ContactSearchRequestOptions>(path, opts); } @@ -257,22 +256,21 @@ public ContactListHubSpotModel RecentlyCreated(ListRecentRe { opts = opts ?? new ListRecentRequestOptions(); - string path = GetRoute("lists", "all", "contacts", "recent"); - - path += $"{QueryParams.COUNT}={opts.Limit}"; + Url path = GetRoute("lists","all","contacts","recent") + .SetQueryParam("count", opts.Limit); if (opts.PropertiesToInclude.Any()) - path += $"{QueryParams.PROPERTY}={opts.PropertiesToInclude}"; + path.SetQueryParam("property", opts.PropertiesToInclude); if (opts.Offset.HasValue) - path = path += $"{QueryParams.VID_OFFSET}={opts.Offset}"; + path = path.SetQueryParam("vidOffset", opts.Offset); if (!string.IsNullOrEmpty(opts.TimeOffset)) - path = path += $"{QueryParams.TIME_OFFSET}={opts.TimeOffset}"; + path = path.SetQueryParam("timeOffset", opts.TimeOffset); - path += $"{QueryParams.PROPERTY_MODE}={opts.PropertyMode}" - + $"{QueryParams.FORM_SUBMISSION_MODE}={opts.FormSubmissionMode}" - + $"{QueryParams.SHOW_LIST_MEMBERSHIPS}={opts.ShowListMemberships}"; + path = path.SetQueryParam("propertyMode", opts.PropertyMode) + .SetQueryParam("formSubmissionMode", opts.FormSubmissionMode) + .SetQueryParam("showListMemberships", opts.ShowListMemberships); return _client.Execute, ListRecentRequestOptions>(path, opts); } @@ -291,18 +289,17 @@ public ContactListHubSpotModel GetList(long listId, ListReq opts = new ListRequestOptions(); } - string path = GetRoute("lists", $"{listId}", "contacts", "all"); - path += $"{QueryParams.COUNT}={opts.Limit}"; + var path = GetRoute("lists", $"{listId}", "contacts", "all").SetQueryParam(QueryParams.COUNT, opts.Limit); if (opts.PropertiesToInclude.Any()) { - path += $"{QueryParams.PROPERTY}={opts.PropertiesToInclude}"; + path.SetQueryParam(QueryParams.PROPERTY, opts.PropertiesToInclude); } if (opts.Offset.HasValue) { - path = path += $"{QueryParams.VID_OFFSET}={opts.Offset}"; + path = path.SetQueryParam(QueryParams.VID_OFFSET, opts.Offset); } var data = _client.Execute>(path); diff --git a/HubSpot.NET/Api/Deal/HubSpotDealApi.cs b/HubSpot.NET/Api/Deal/HubSpotDealApi.cs index 1c3bba60..0efd0597 100644 --- a/HubSpot.NET/Api/Deal/HubSpotDealApi.cs +++ b/HubSpot.NET/Api/Deal/HubSpotDealApi.cs @@ -1,14 +1,15 @@ namespace HubSpot.NET.Api.Deal { + using System; + using System.Linq; + using System.Net; + using Flurl; using HubSpot.NET.Api.Deal.Dto; using HubSpot.NET.Api.Shared; using HubSpot.NET.Core; using HubSpot.NET.Core.Abstracts; using HubSpot.NET.Core.Interfaces; using RestSharp; - using System; - using System.Linq; - using System.Net; public class HubSpotDealApi : ApiRoutable, IHubSpotDealApi { @@ -31,7 +32,7 @@ public DealHubSpotModel Create(DealHubSpotModel entity) NameTransportModel model = new NameTransportModel(); model.ToPropertyTransportModel(entity); - return _client.Execute>(GetRoute(), model, Method.POST); + return _client.Execute>(GetRoute(), model, Method.POST); } /// @@ -62,10 +63,10 @@ public DealHubSpotModel GetById(long dealId) /// The updated deal entity public DealHubSpotModel Update(DealHubSpotModel entity) { - if (entity.Id < 1) + if (entity.Id < 1) throw new ArgumentException("Deal entity must have an id set!"); - return _client.Execute(GetRoute(entity.Id.ToString()), entity, method: Method.PUT); + return _client.Execute(GetRoute(entity.Id.ToString()), entity, method: Method.PUT); } /// @@ -78,18 +79,16 @@ public DealListHubSpotModel List(bool includeAssociations, Lis { opts = opts ?? new ListRequestOptions(250); - string path = GetRoute>("deal", "paged"); + Url path = GetRoute>("deal", "paged").SetQueryParam("limit", opts.Limit); - path += $"{QueryParams.LIMIT}={opts.Limit}"; + if (opts.Offset.HasValue) + path = path.SetQueryParam(QueryParams.OFFSET, opts.Offset); - if (opts.Offset.HasValue) - path += $"{QueryParams.OFFSET}={opts.Offset}"; + if (includeAssociations) + path = path.SetQueryParam(QueryParams.INCLUDE_ASSOCIATIONS, "true"); - if (includeAssociations) - path += $"{QueryParams.INCLUDE_ASSOCIATIONS}=true"; - - if (opts.PropertiesToInclude.Any()) - path += $"{QueryParams.PROPERTIES}={opts.PropertiesToInclude}"; + if (opts.PropertiesToInclude.Any()) + path = path.SetQueryParam(QueryParams.PROPERTIES, opts.PropertiesToInclude); return _client.Execute, ListRequestOptions>(path, opts); } @@ -105,20 +104,19 @@ public DealListHubSpotModel List(bool includeAssociations, Lis /// List of deals public DealListHubSpotModel ListAssociated(bool includeAssociations, long hubId, ListRequestOptions opts = null, string objectName = "contact") { - opts = opts ?? new ListRequestOptions(); - - string path = GetRoute>("deal", "associated", $"{objectName}", $"{hubId}", "paged"); + opts = opts ?? new ListRequestOptions(); - path += $"{QueryParams.LIMIT}={opts.Limit}"; + Url path = GetRoute>("deal","associated",$"{objectName}",$"{hubId}","paged") + .SetQueryParam(QueryParams.LIMIT, opts.Limit); - if (opts.Offset.HasValue) - path += $"{QueryParams.OFFSET}={opts.Offset}"; + if (opts.Offset.HasValue) + path = path.SetQueryParam(QueryParams.OFFSET, opts.Offset); - if (includeAssociations) - path += $"{QueryParams.INCLUDE_ASSOCIATIONS}=true"; + if (includeAssociations) + path = path.SetQueryParam(QueryParams.INCLUDE_ASSOCIATIONS, "true"); - if (opts.PropertiesToInclude.Any()) - path += $"{QueryParams.PROPERTIES}={opts.PropertiesToInclude}"; + if (opts.PropertiesToInclude.Any()) + path = path.SetQueryParam(QueryParams.PROPERTIES, opts.PropertiesToInclude); return _client.Execute, ListRequestOptions>(path, opts); } @@ -127,7 +125,7 @@ public DealListHubSpotModel ListAssociated(bool includeAssocia /// Deletes a given deal (by ID) /// /// ID of the deal - public void Delete(long dealId) + public void Delete(long dealId) => _client.ExecuteOnly(GetRoute(dealId.ToString()), method: Method.DELETE); /// @@ -138,23 +136,22 @@ public void Delete(long dealId) /// List of deals public DealRecentListHubSpotModel RecentlyCreated(DealRecentRequestOptions opts = null) { - opts = opts ?? new DealRecentRequestOptions(); - - string path = $"{GetRoute>()}/deal/recent/created"; + opts = opts ?? new DealRecentRequestOptions(); - path += $"{QueryParams.LIMIT}={opts.Limit}"; + Url path = $"{GetRoute>()}/deal/recent/created" + .SetQueryParam(QueryParams.LIMIT, opts.Limit); - if (opts.Offset.HasValue) - path += $"{QueryParams.OFFSET}={opts.Offset}"; + if (opts.Offset.HasValue) + path = path.SetQueryParam(QueryParams.OFFSET, opts.Offset); - if (opts.IncludePropertyVersion) - path += $"{QueryParams.INCLUDE_PROPERTY_VERSIONS}=true"; + if (opts.IncludePropertyVersion) + path = path.SetQueryParam(QueryParams.INCLUDE_PROPERTY_VERSIONS, "true"); - if (!string.IsNullOrEmpty(opts.Since)) - path += $"{QueryParams.SINCE}={opts.Since}"; + if (!string.IsNullOrEmpty(opts.Since)) + path = path.SetQueryParam(QueryParams.SINCE, opts.Since); - return _client.Execute, DealRecentRequestOptions>(path, opts); + return _client.Execute, DealRecentRequestOptions>(path, opts); } /// @@ -165,19 +162,19 @@ public DealRecentListHubSpotModel RecentlyCreated(DealRecentRe /// List of deals public DealRecentListHubSpotModel RecentlyUpdated(DealRecentRequestOptions opts = null) { - opts = opts ?? new DealRecentRequestOptions(); + opts = opts ?? new DealRecentRequestOptions(); - string path = GetRoute>("deal", "recent", "modified"); - path += $"{QueryParams.LIMIT}={opts.Limit}"; + var path = GetRoute>("deal","recent","modified").SetQueryParam(QueryParams.LIMIT, opts.Limit); - if (opts.Offset.HasValue) - path += $"{QueryParams.OFFSET}={opts.Offset}"; + if (opts.Offset.HasValue) + path = path.SetQueryParam(QueryParams.OFFSET, opts.Offset); if (opts.IncludePropertyVersion) - path += $"{QueryParams.INCLUDE_PROPERTY_VERSIONS}=true"; + path = path.SetQueryParam(QueryParams.INCLUDE_PROPERTY_VERSIONS, "true"); + + if (!string.IsNullOrEmpty(opts.Since)) + path = path.SetQueryParam(QueryParams.SINCE, opts.Since); - if (!string.IsNullOrEmpty(opts.Since)) - path += $"{QueryParams.SINCE}={opts.Since}"; return _client.Execute, DealRecentRequestOptions>(path, opts); } diff --git a/HubSpot.NET/Api/EmailEvents/HubSpotEmailEventsApi.cs b/HubSpot.NET/Api/EmailEvents/HubSpotEmailEventsApi.cs index 883aa143..9b9c4926 100644 --- a/HubSpot.NET/Api/EmailEvents/HubSpotEmailEventsApi.cs +++ b/HubSpot.NET/Api/EmailEvents/HubSpotEmailEventsApi.cs @@ -1,10 +1,11 @@ namespace HubSpot.NET.Api.EmailEvents { + using System.Net; + using Flurl; using HubSpot.NET.Api.EmailEvents.Dto; - using HubSpot.NET.Core; - using HubSpot.NET.Core.Interfaces; + using HubSpot.NET.Core; + using HubSpot.NET.Core.Interfaces; using RestSharp; - using System.Net; public class HubSpotEmailEventsApi : IHubSpotEmailEventsApi { @@ -24,7 +25,7 @@ public HubSpotEmailEventsApi(IHubSpotClient client) /// The campaign data entity or null if the compaign does not exist. public T GetCampaignDataById(long campaignId, long appId) where T : EmailCampaignDataHubSpotModel, new() { - var path = $"{(new T()).RouteBasePath}/{campaignId}?{QueryParams.APP_ID}={appId}"; + var path = $"{(new T()).RouteBasePath}/{campaignId}".SetQueryParam(QueryParams.APP_ID, appId); try { @@ -52,10 +53,13 @@ public HubSpotEmailEventsApi(IHubSpotClient client) opts = new EmailCampaignListRequestOptions { Limit = 250 }; } - var path = $"{new EmailCampaignListHubSpotModel().RouteBasePath}/by-id?{QueryParams.LIMIT}={opts.Limit}"; + var path = $"{new EmailCampaignListHubSpotModel().RouteBasePath}/by-id" + .SetQueryParam(QueryParams.LIMIT, opts.Limit); - if (!string.IsNullOrEmpty(opts.Offset)) - path += $"{QueryParams.OFFSET}={opts.Offset}"; + if (!string.IsNullOrEmpty(opts.Offset)) + { + path = path.SetQueryParam(QueryParams.OFFSET, opts.Offset); + } var data = _client.Execute>(path); @@ -75,10 +79,13 @@ public HubSpotEmailEventsApi(IHubSpotClient client) opts = new EmailCampaignListRequestOptions { Limit = 250 }; } - var path = $"{new EmailCampaignListHubSpotModel().RouteBasePath}?{QueryParams.LIMIT}={opts.Limit}"; + var path = $"{new EmailCampaignListHubSpotModel().RouteBasePath}" + .SetQueryParam(QueryParams.LIMIT, opts.Limit); - if (!string.IsNullOrEmpty(opts.Offset)) - path += $"{QueryParams.OFFSET}={opts.Offset}"; + if (!string.IsNullOrEmpty(opts.Offset)) + { + path = path.SetQueryParam(QueryParams.OFFSET, opts.Offset); + } var data = _client.Execute>(path); diff --git a/HubSpot.NET/Api/Engagement/HubSpotEngagementApi.cs b/HubSpot.NET/Api/Engagement/HubSpotEngagementApi.cs index 7551d810..017c80fa 100644 --- a/HubSpot.NET/Api/Engagement/HubSpotEngagementApi.cs +++ b/HubSpot.NET/Api/Engagement/HubSpotEngagementApi.cs @@ -1,13 +1,14 @@ namespace HubSpot.NET.Api.Engagement { + using System; + using System.Net; + using Flurl; using HubSpot.NET.Api.Engagement.Dto; - using HubSpot.NET.Core; - using HubSpot.NET.Core.Abstracts; + using HubSpot.NET.Core; + using HubSpot.NET.Core.Abstracts; using HubSpot.NET.Core.Interfaces; using RestSharp; - using System; - using System.Net; public class HubSpotEngagementApi : ApiRoutable, IHubSpotEngagementApi { @@ -68,10 +69,10 @@ public EngagementListHubSpotModel List(EngagementListRequestOptions opts = { opts = opts ?? new EngagementListRequestOptions(); - var path = $"{GetRoute("paged")}?{QueryParams.LIMIT}={opts.Limit}"; + var path = $"{GetRoute("paged")}".SetQueryParam(QueryParams.LIMIT, opts.Limit); if (opts.Offset.HasValue) - path += $"{QueryParams.OFFSET}={opts.Offset}"; + path = path.SetQueryParam(QueryParams.OFFSET, opts.Offset); return _client.Execute, EngagementListRequestOptions>(path, opts); } @@ -85,10 +86,10 @@ public EngagementListHubSpotModel ListRecent(EngagementListRequestOptions { opts = opts ?? new EngagementListRequestOptions(); - var path = $"{GetRoute()}/engagements/recent/modified?{QueryParams.COUNT}={opts.Limit}"; + var path = $"{GetRoute()}/engagements/recent/modified".SetQueryParam(QueryParams.COUNT, opts.Limit); if (opts.Offset.HasValue) - path += $"{QueryParams.OFFSET}={opts.Offset}"; + path = path.SetQueryParam(QueryParams.OFFSET, opts.Offset); return _client.Execute, EngagementListRequestOptions>(path, opts); } @@ -120,10 +121,10 @@ public EngagementListHubSpotModel ListAssociated(long objectId, string obj { opts = opts ?? new EngagementListRequestOptions(); - var path = $"{GetRoute()}/engagements/associated/{objectType}/{objectId}/paged?{QueryParams.LIMIT}={opts.Limit}"; + var path = $"{GetRoute()}/engagements/associated/{objectType}/{objectId}/paged".SetQueryParam(QueryParams.LIMIT, opts.Limit); if (opts.Offset.HasValue) - path += $"{QueryParams.OFFSET}={opts.Offset}"; + path = path.SetQueryParam(QueryParams.OFFSET, opts.Offset); return _client.Execute, EngagementListRequestOptions>(path, opts); } diff --git a/HubSpot.NET/Api/Pipeline/HubSpotPipelinesApi.cs b/HubSpot.NET/Api/Pipeline/HubSpotPipelinesApi.cs index b1860b20..70af4a80 100644 --- a/HubSpot.NET/Api/Pipeline/HubSpotPipelinesApi.cs +++ b/HubSpot.NET/Api/Pipeline/HubSpotPipelinesApi.cs @@ -1,4 +1,5 @@ -using HubSpot.NET.Api.Pipeline.Dto; +using Flurl; +using HubSpot.NET.Api.Pipeline.Dto; using HubSpot.NET.Core.Interfaces; namespace HubSpot.NET.Api.Pipeline @@ -22,7 +23,8 @@ public HubSpotPipelinesApi(IHubSpotClient client) /// The requested list public PipelineListHubSpotModel List(string objectType, string includeInactive = "EXCLUDE_DELETED") where T : PipelineHubSpotModel, new() { - string path = $"{new PipelineListHubSpotModel().RouteBasePath}/pipelines/{objectType}?includeInactive={includeInactive}"; + Url path = $"{new PipelineListHubSpotModel().RouteBasePath}/pipelines/{objectType}"; + path.SetQueryParam("includeInactive", includeInactive); var data = _client.Execute>(path, method: RestSharp.Method.GET); diff --git a/HubSpot.NET/Core/Abstracts/ApiRoutable.cs b/HubSpot.NET/Core/Abstracts/ApiRoutable.cs index 3b0bd6a5..3bc9ce94 100644 --- a/HubSpot.NET/Core/Abstracts/ApiRoutable.cs +++ b/HubSpot.NET/Core/Abstracts/ApiRoutable.cs @@ -1,7 +1,10 @@ -using HubSpot.NET.Core.Interfaces; +using HubSpot.NET.Api.Deal.Dto; +using HubSpot.NET.Core.Interfaces; using System; using System.Collections.Generic; using System.Linq; +using System.Text; +using System.Threading.Tasks; namespace HubSpot.NET.Core.Abstracts { diff --git a/HubSpot.NET/Core/HubSpotBaseClient.cs b/HubSpot.NET/Core/HubSpotBaseClient.cs index 2084b4b3..346dc3a6 100644 --- a/HubSpot.NET/Core/HubSpotBaseClient.cs +++ b/HubSpot.NET/Core/HubSpotBaseClient.cs @@ -112,7 +112,8 @@ public void UpdateToken(HubSpotToken token) RestRequest request = ConfigureRequestAuthentication(path, method); if(!entity.Equals(default(K))) - request.AddJsonBody(entity); + request.AddJsonBody(entity); + IRestResponse response = _client.Execute(request); diff --git a/HubSpot.NET/Core/Interfaces/IHubSpotClient.cs b/HubSpot.NET/Core/Interfaces/IHubSpotClient.cs index 6d7d7c58..47426f45 100644 --- a/HubSpot.NET/Core/Interfaces/IHubSpotClient.cs +++ b/HubSpot.NET/Core/Interfaces/IHubSpotClient.cs @@ -8,6 +8,7 @@ public interface IHubSpotClient { string AppId { get; } string BasePath { get; } + T Execute(string absoluteUriPath, Method method = Method.GET) where T: new(); T Execute(string absoluteUriPath, K entity, Method method = Method.GET) where T: new(); T ExecuteMultipart(string absoluteUriPath, byte[] data, string filename, Dictionary parameters, Method method = Method.POST); diff --git a/HubSpot.NET/HubSpot.NET.csproj b/HubSpot.NET/HubSpot.NET.csproj index 8a3a3fb9..daf21353 100644 --- a/HubSpot.NET/HubSpot.NET.csproj +++ b/HubSpot.NET/HubSpot.NET.csproj @@ -22,6 +22,7 @@ 7.3 +