diff --git a/Podio.API/Client.cs b/Podio.API/Client.cs
index 6a0e6fc..989d25e 100644
--- a/Podio.API/Client.cs
+++ b/Podio.API/Client.cs
@@ -1,4 +1,5 @@
-using Podio.API.Exceptions;
+using System.Web.Configuration;
+using Podio.API.Exceptions;
using Podio.API.Utils;
using System;
using System.Collections.Generic;
@@ -188,5 +189,6 @@ public static Client ConnectWithAuthorizationCode(string clientId, string client
public Services.TaskService TaskService { get { return new Services.TaskService(this); } }
+ public Services.ContactService ContactService { get { return new Services.ContactService(this); } }
}
}
diff --git a/Podio.API/Podio.API.csproj b/Podio.API/Podio.API.csproj
index 88dd7a8..59ba196 100644
--- a/Podio.API/Podio.API.csproj
+++ b/Podio.API/Podio.API.csproj
@@ -134,6 +134,7 @@
+
diff --git a/Podio.API/Services/ContactService.cs b/Podio.API/Services/ContactService.cs
new file mode 100644
index 0000000..3ac194d
--- /dev/null
+++ b/Podio.API/Services/ContactService.cs
@@ -0,0 +1,84 @@
+using System.Runtime.Serialization;
+using Podio.API.Model;
+using Podio.API.Utils;
+
+namespace Podio.API.Services
+{
+ public class ContactService
+ {
+ private Client _client;
+ ///
+ /// Add a client and you can use this as a shortcut to the Podio REST API
+ ///
+ public ContactService(Client client)
+ {
+ _client = client;
+ }
+
+
+ // TODO
+ [DataContract]
+ public struct CreateUpdateRequest
+ {
+ [DataMember(IsRequired = false, Name = "name")]
+ public string Name { get; set; }
+
+ [DataMember(IsRequired = false, Name = "address")]
+ public string[] Address { get; set; }
+
+ [DataMember(IsRequired = false, Name = "city")]
+ public string City { get; set; }
+
+ [DataMember(IsRequired = false, Name = "state")]
+ public string State { get; set; }
+
+ [DataMember(IsRequired = false, Name = "zip")]
+ public string Zip { get; set; }
+
+ [DataMember(IsRequired = false, Name = "country")]
+ public string Country { get; set; }
+
+ [DataMember(IsRequired = false, Name = "mail")]
+ public string[] Mail { get; set; }
+
+ [DataMember(IsRequired = false, Name = "phone")]
+ public string[] Phone { get; set; }
+
+ [DataMember(IsRequired = false, Name = "url")]
+ public string[] Url { get; set; }
+ }
+
+
+
+
+ ///
+ /// https://developers.podio.com/doc/items/add-new-item-22362
+ ///
+ public int CreateSpaceContact(int spaceId, Contact contact)
+ {
+ var requestData = new CreateUpdateRequest
+ {
+ Name = contact.Name,
+ Address = contact.Address,
+ City = contact.City,
+ State = contact.State,
+ Zip = contact.Zip,
+ Country = contact.Country,
+ Mail = contact.Mail,
+ Phone = contact.Phone,
+ Url = contact.Url
+ };
+ var newContact = CreateSpaceContact(spaceId, requestData);
+ contact.ProfileId = newContact.ProfileId;
+ return (int)contact.ProfileId;
+ }
+
+ ///
+ /// https://developers.podio.com/doc/items/add-new-item-22362
+ ///
+ public Contact CreateSpaceContact(int spaceId, CreateUpdateRequest requestData)
+ {
+ return PodioRestHelper.JSONRequest(Constants.PODIOAPI_BASEURL + "/contact/space/" + spaceId + "/", _client.AuthInfo.AccessToken, requestData, PodioRestHelper.RequestMethod.POST).Data;
+ }
+ }
+}