diff --git a/IntercomDotnet/Resources/Notes.cs b/IntercomDotnet/Resources/Notes.cs index 77d7049..c33480d 100644 --- a/IntercomDotnet/Resources/Notes.cs +++ b/IntercomDotnet/Resources/Notes.cs @@ -1,7 +1,7 @@ -using System; - -namespace IntercomDotNet.Resources +namespace IntercomDotNet.Resources { + using RestSharp; + public class Notes : Resource { public Notes(Client client, string baseUrl) : base(client, baseUrl) @@ -10,7 +10,31 @@ public Notes(Client client, string baseUrl) : base(client, baseUrl) public dynamic Post(object hash) { - throw new NotImplementedException("Notes have not been converted to V2 API format yet"); + return Client.Execute(BaseUrl, Method.POST, request => + { + request.RequestFormat = DataFormat.Json; + request.AddBody(hash); + }); + } + + public dynamic Get(string email = null, int? userId = null) + { + return Client.Execute(BaseUrl, Method.GET, request => + { + if (email != null) + request.AddParameter("email", email); + + if (userId != null) + request.AddParameter("user_id", userId.Value); + }); + } + + public dynamic Get(int noteId) + { + return Client.Execute(BaseUrl + "/{id}", Method.GET, request => + { + request.AddUrlSegment("id", noteId.ToString()); + }); } } } \ No newline at end of file