Skip to content

Commit 78dbaa2

Browse files
authored
Adding GetByUserToken to Contact API implementation
1 parent da7f7e4 commit 78dbaa2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

HubSpot.NET/Api/Contact/HubSpotContactApi.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ public HubSpotContactApi(IHubSpotClient client)
5656
var data = _client.Execute<T>(path, Method.GET);
5757
return data;
5858
}
59+
60+
/// <summary>
61+
/// Gets a contact by their user token
62+
/// </summary>
63+
/// <param name="userToken">User token to search for from hubspotutk cookie</param>
64+
/// <typeparam name="T">Implementation of ContactHubSpotModel</typeparam>
65+
/// <returns>The contact entity</returns>
66+
public T GetByUserToken<T>(string userToken) where T : ContactHubSpotModel, new()
67+
{
68+
var path = $"{new T().RouteBasePath}/contact/utk/{userToken}/profile";
69+
var data = _client.Execute<T>(path, Method.GET);
70+
return data;
71+
}
5972

6073
/// <summary>
6174
/// List all available contacts
@@ -214,4 +227,4 @@ public void Delete(long contactId)
214227
return data;
215228
}
216229
}
217-
}
230+
}

0 commit comments

Comments
 (0)