diff --git a/.gitignore b/.gitignore index 983bc9d..425b64d 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,5 @@ obj Source/packages/* Source/.vs/* -project.lock.json \ No newline at end of file +project.lock.json +/.vs diff --git a/Source/Podio .NET/Models/Comment.cs b/Source/Podio .NET/Models/Comment.cs index 8f0d53a..6e499f9 100644 --- a/Source/Podio .NET/Models/Comment.cs +++ b/Source/Podio .NET/Models/Comment.cs @@ -7,7 +7,7 @@ namespace PodioAPI.Models public class Comment { [JsonProperty("comment_id")] - public int CommentId { get; set; } + public long CommentId { get; set; } [JsonProperty("value")] public string Value { get; set; } diff --git a/Source/Podio .NET/Models/Item.cs b/Source/Podio .NET/Models/Item.cs index 2c38f6c..b884fe1 100644 --- a/Source/Podio .NET/Models/Item.cs +++ b/Source/Podio .NET/Models/Item.cs @@ -9,7 +9,7 @@ namespace PodioAPI.Models public class Item { [JsonProperty("item_id")] - public int ItemId { get; set; } + public long ItemId { get; set; } [JsonProperty("external_id")] public string ExternalId { get; set; } diff --git a/Source/Podio .NET/Models/Reference.cs b/Source/Podio .NET/Models/Reference.cs index a0a61a4..2d076ec 100644 --- a/Source/Podio .NET/Models/Reference.cs +++ b/Source/Podio .NET/Models/Reference.cs @@ -10,7 +10,7 @@ public class Reference public string Type { get; set; } [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } + public long? Id { get; set; } [JsonProperty(PropertyName = "title")] public string Title { get; private set; } diff --git a/Source/Podio .NET/Services/CommentService.cs b/Source/Podio .NET/Services/CommentService.cs index e8a4a4e..9cbd07c 100644 --- a/Source/Podio .NET/Services/CommentService.cs +++ b/Source/Podio .NET/Services/CommentService.cs @@ -20,7 +20,7 @@ public CommentService(Podio currentInstance) /// Podio API Reference: https://developers.podio.com/doc/comments/delete-a-comment-22347 /// /// - public async Task DeleteComment(int commentId) + public async Task DeleteComment(long commentId) { string url = string.Format("/comment/{0}", commentId); return await _podio.Delete(url); @@ -32,7 +32,7 @@ public async Task DeleteComment(int commentId) /// /// /// - public async Task GetComment(int commentId) + public async Task GetComment(long commentId) { string url = string.Format("/comment/{0}", commentId); return await _podio.Get(url); @@ -46,7 +46,7 @@ public async Task GetComment(int commentId) /// /// /// - public async Task> GetCommentsOnObject(string type, int id) + public async Task> GetCommentsOnObject(string type, long id) { string url = string.Format("/comment/{0}/{1}/", type, id); return await _podio.Get>(url); @@ -76,7 +76,7 @@ public async Task> GetCommentsOnObject(string type, int id) /// /// todo: describe hook parameter on AddCommentToObject /// - public async Task AddCommentToObject(string type, int id, string text, string externalId = null, + public async Task AddCommentToObject(string type, long id, string text, string externalId = null, List fileIds = null, string embedUrl = null, int? embedId = null, bool alertInvite = false, bool silent = false, bool hook = true) { @@ -108,13 +108,13 @@ public async Task AddCommentToObject(string type, int id, string text, stri /// /// todo: describe hook parameter on AddCommentToObject /// - public async Task AddCommentToObject(string type, int id, CommentCreateUpdateRequest comment, bool alertInvite = false, + public async Task AddCommentToObject(string type, long id, CommentCreateUpdateRequest comment, bool alertInvite = false, bool silent = false, bool hook = true) { string url = string.Format("/comment/{0}/{1}/", type, id); url = Utility.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook, null, alertInvite)); dynamic response = await _podio.Post(url, comment); - return (int) response["comment_id"]; + return (long) response["comment_id"]; } /// @@ -131,7 +131,7 @@ public async Task AddCommentToObject(string type, int id, CommentCreateUpda /// The id of an embedded link that has been created with the Add an embed operation in the Embed /// area /// - public async Task UpdateComment(int commentId, string text, string externalId = null, List fileIds = null, + public async Task UpdateComment(long commentId, string text, string externalId = null, List fileIds = null, string embedUrl = null, int? embedId = null) { var requestData = new CommentCreateUpdateRequest() @@ -151,7 +151,7 @@ public async Task UpdateComment(int commentId, string text, string ext /// /// /// - public async Task UpdateComment(int commentId, CommentCreateUpdateRequest comment) + public async Task UpdateComment(long commentId, CommentCreateUpdateRequest comment) { string url = string.Format("/comment/{0}", commentId); return await _podio.Put(url, comment); diff --git a/Source/Podio .NET/Services/ItemService.cs b/Source/Podio .NET/Services/ItemService.cs index 8e503f5..c46ab32 100644 --- a/Source/Podio .NET/Services/ItemService.cs +++ b/Source/Podio .NET/Services/ItemService.cs @@ -31,7 +31,7 @@ public ItemService(Podio currentInstance) /// /// If set to false, hooks will not be executed for the change /// Id of the created item - public async Task AddNewItem(int appId, Item item, int? spaceId = null, bool silent = false, bool hook = true) + public async Task AddNewItem(int appId, Item item, int? spaceId = null, bool silent = false, bool hook = true) { JArray fieldValues = JArray.FromObject(item.Fields.Select(f => new { external_id = f.ExternalId, field_id = f.FieldId, values = f.Values })); @@ -188,7 +188,7 @@ public async Task AddNewItem(int appId, Item item, int? spaceId = null, boo /// If true marks any new notifications on the given item as viewed, otherwise leaves any /// notifications untouched, Default value true /// - public async Task GetItem(int itemId, bool markedAsViewed = true) + public async Task GetItem(long itemId, bool markedAsViewed = true) { string markAsViewdValue = markedAsViewed == true ? "1" : "0"; var requestData = new Dictionary() @@ -210,7 +210,7 @@ public async Task GetItem(int itemId, bool markedAsViewed = true) /// notifications untouched, Default value true /// /// - public async Task GetItemBasic(int itemId, bool markedAsViewed = true) + public async Task GetItemBasic(long itemId, bool markedAsViewed = true) { string viewedVal = markedAsViewed == true ? "1" : "0"; var requestData = new Dictionary() @@ -357,12 +357,12 @@ public async Task BulkDeleteItems(int appId, BulkDeleteReque /// generated /// /// The id of the cloned item - public async Task CloneItem(int itemId, bool silent = false) + public async Task CloneItem(long itemId, bool silent = false) { string url = string.Format("/item/{0}/clone", itemId); url = Utility.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent)); dynamic tw = await _podio.Post(url); - return int.Parse(tw["item_id"].ToString()); + return long.Parse(tw["item_id"].ToString()); } /// @@ -375,7 +375,7 @@ public async Task CloneItem(int itemId, bool silent = false) /// generated /// /// If set to false, hooks will not be executed for the change - public async System.Threading.Tasks.Task DeleteItem(int itemId, bool silent = false, bool hook = true) + public async System.Threading.Tasks.Task DeleteItem(long itemId, bool silent = false, bool hook = true) { string url = string.Format("/item/{0}", itemId); url = Utility.PrepareUrlWithOptions(url, new CreateUpdateOptions(silent, hook)); @@ -387,7 +387,7 @@ public async System.Threading.Tasks.Task DeleteItem(int itemId, bool silent = fa /// Podio API Reference: https://developers.podio.com/doc/items/delete-item-reference-7302326 /// /// - public async System.Threading.Tasks.Task DeleteItemReference(int itemId) + public async System.Threading.Tasks.Task DeleteItemReference(long itemId) { string url = string.Format("/item/{0}/ref", itemId); await _podio.Delete(url); @@ -472,7 +472,7 @@ public async Task> FilterItemsByView(int appId, int viewId /// The maximum number of results to return Default value: 13 /// If supplied the items with these ids will not be returned /// - public async Task> GetTopValuesByField(int fieldId, int limit = 13, int[] notItemIds = null) + public async Task> GetTopValuesByField(int fieldId, int limit = 13, long[] notItemIds = null) { string itemIdCSV = Utility.ArrayToCSV(notItemIds); var requestData = new Dictionary() @@ -509,7 +509,7 @@ public async Task GetAppValues(int appId) /// /// /// - public async Task GetItemFieldValues(int itemId, int fieldId) where T : new() + public async Task GetItemFieldValues(long itemId, int fieldId) where T : new() { string url = string.Format("/item/{0}/value/{1}", itemId, fieldId); return await _podio.Get(url); @@ -522,7 +522,7 @@ public async Task GetAppValues(int appId) /// /// /// - public async Task GetItemBasicByField(int itemId, string fieldId) + public async Task GetItemBasicByField(long itemId, string fieldId) { string url = string.Format("/item/{0}/reference/{1}/preview", itemId, fieldId); return await _podio.Get(url); @@ -535,7 +535,7 @@ public async Task GetItemBasicByField(int itemId, string fieldId) /// /// /// - public async Task> GetItemReferences(int itemId) + public async Task> GetItemReferences(long itemId) { string url = string.Format("/item/{0}/reference/", itemId); return await _podio.Get>(url); @@ -573,7 +573,7 @@ public async Task GetFieldRanges(int fieldId) /// /// /// - public async Task> GetItemValues(int itemId) + public async Task> GetItemValues(long itemId) { string url = string.Format("/item/{0}/value", itemId); return await _podio.Get>(url); @@ -585,7 +585,7 @@ public async Task> GetItemValues(int itemId) /// /// /// - public async Task GetItemRevision(int itemId, int revision) + public async Task GetItemRevision(long itemId, int revision) { string url = string.Format("/item/{0}/revision/{1}", itemId, revision); return await _podio.Get(url); @@ -597,7 +597,7 @@ public async Task GetItemRevision(int itemId, int revision) /// /// /// - public async Task> GetItemRevisions(int itemId) + public async Task> GetItemRevisions(long itemId) { string url = string.Format("/item/{0}/revision/", itemId); return await _podio.Get>(url); @@ -610,7 +610,7 @@ public async Task> GetItemRevisions(int itemId) /// /// /// - public async Task GetMeetingUrl(int itemId) + public async Task GetMeetingUrl(long itemId) { string url = string.Format("/item/{0}/meeting/url", itemId); dynamic response = await _podio.Get(url); @@ -626,7 +626,7 @@ public async Task GetMeetingUrl(int itemId) /// /// /// The new status, either "invited", "accepted", "declined" or "tentative" - public async System.Threading.Tasks.Task SetParticipation(int itemId, string status) + public async System.Threading.Tasks.Task SetParticipation(long itemId, string status) { dynamic requestData = new { @@ -644,7 +644,7 @@ public async System.Threading.Tasks.Task SetParticipation(int itemId, string sta /// /// /// - public async Task> GetReferencesToItemByField(int itemId, int fieldId, int limit = 20) + public async Task> GetReferencesToItemByField(long itemId, int fieldId, int limit = 20) { var requestData = new Dictionary() { @@ -661,7 +661,7 @@ public async Task> GetReferencesToItemByField(int itemId, int fi /// /// The type of the reference /// The id of the reference - public async System.Threading.Tasks.Task UpdateItemReference(int itemId, string type, int referenceId) + public async System.Threading.Tasks.Task UpdateItemReference(long itemId, string type, int referenceId) { dynamic requestData = new { @@ -680,7 +680,7 @@ public async System.Threading.Tasks.Task UpdateItemReference(int itemId, string /// /// /// The id of the new revision - public async Task RevertItemRevision(int itemId, int revisionId) + public async Task RevertItemRevision(long itemId, int revisionId) { var url = string.Format("/item/{0}/revision/{1}", itemId, revisionId); var response = await _podio.Delete(url); @@ -698,7 +698,7 @@ public async System.Threading.Tasks.Task UpdateItemReference(int itemId, string /// /// /// revision - public async Task RevertToRevision(int itemId, int revision) + public async Task RevertToRevision(long itemId, int revision) { var url = string.Format("/item/{0}/revision/{1}/revert_to", itemId, revision); var response = await _podio.Delete(url); @@ -723,7 +723,7 @@ public async System.Threading.Tasks.Task UpdateItemReference(int itemId, string /// /// The text to search for. The search will be lower case, and with a wildcard in each end. /// - public async Task> FindReferenceableItems(int fieldId, int limit = 13, int[] notItemIds = null, + public async Task> FindReferenceableItems(int fieldId, int limit = 13, long[] notItemIds = null, string sort = null, string text = null) { string itemIdCSV = Utility.ArrayToCSV(notItemIds); @@ -744,7 +744,7 @@ public async Task> FindReferenceableItems(int fieldId, int limit = 13 /// /// /// - public async Task GetItemClone(int itemId) + public async Task GetItemClone(long itemId) { string url = string.Format("/item/{0}/clone", itemId); return await _podio.Get(url); @@ -758,13 +758,13 @@ public async Task GetItemClone(int itemId) /// /// /// - public async Task> GetItemRevisionDifference(int itemId, int revisionFrom, int revisionTo) + public async Task> GetItemRevisionDifference(long itemId, int revisionFrom, int revisionTo) { string url = string.Format("/item/{0}/revision/{1}/{2}", itemId, revisionFrom, revisionTo); return await _podio.Get>(url); } - public async Task Calcualate(int itemId, ItemCalculateRequest ItemCalculateRequest, int limit = 30) + public async Task Calcualate(long itemId, ItemCalculateRequest ItemCalculateRequest, int limit = 30) { ItemCalculateRequest.Limit = ItemCalculateRequest.Limit == 0 ? 30 : ItemCalculateRequest.Limit; string url = string.Format("/item/app/{0}/calculate", itemId); diff --git a/Source/Podio .NET/Utils/Utilities.cs b/Source/Podio .NET/Utils/Utilities.cs index 5cf8795..cf59219 100644 --- a/Source/Podio .NET/Utils/Utilities.cs +++ b/Source/Podio .NET/Utils/Utilities.cs @@ -18,6 +18,14 @@ internal static string ArrayToCSV(int[] array, string splitter = ",") return string.Empty; } + internal static string ArrayToCSV(long[] array, string splitter = ",") + { + if (array != null && array.Length > 0) + return string.Join(splitter, array); + + return string.Empty; + } + internal static string ArrayToCSV(string[] array, string splitter = ",") { if (array != null && array.Length > 0)