Skip to content

Commit

Permalink
ADDED: Notes endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoodfellow committed Jul 7, 2015
1 parent 2942190 commit 959d680
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions IntercomDotnet/Resources/Notes.cs
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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());
});
}
}
}

0 comments on commit 959d680

Please sign in to comment.