From 69d2c9050f31a1bb406d6b84e4b40c4640efcfe0 Mon Sep 17 00:00:00 2001 From: Michael Marziani Date: Thu, 30 Jun 2022 15:24:38 +0200 Subject: [PATCH 1/7] Change item id from int to long --- Source/Podio .NET/Models/Item.cs | 2 +- Source/Podio .NET/Services/ItemService.cs | 42 +++++++++++------------ 2 files changed, 22 insertions(+), 22 deletions(-) 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/Services/ItemService.cs b/Source/Podio .NET/Services/ItemService.cs index 8e503f5..3729ffb 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 })); @@ -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); @@ -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); @@ -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); From d90a1c7c90458417cfe21b1d7130f57014f4eeb4 Mon Sep 17 00:00:00 2001 From: Michael Marziani Date: Mon, 11 Jul 2022 13:17:44 +0200 Subject: [PATCH 2/7] Return value should be a long as this is an item_id --- Source/Podio .NET/Services/ItemService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Podio .NET/Services/ItemService.cs b/Source/Podio .NET/Services/ItemService.cs index 3729ffb..2122b65 100644 --- a/Source/Podio .NET/Services/ItemService.cs +++ b/Source/Podio .NET/Services/ItemService.cs @@ -357,7 +357,7 @@ public async Task BulkDeleteItems(int appId, BulkDeleteReque /// generated /// /// The id of the cloned item - public async Task CloneItem(long 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)); From 3ea74d29716dc4188242f8972bd13e4c24735f0b Mon Sep 17 00:00:00 2001 From: Michael Marziani Date: Mon, 18 Jul 2022 11:46:37 +0200 Subject: [PATCH 3/7] Additional places item Id needs to be changed from int to long Pointed out by @JonTvermose --- Source/Podio .NET/Services/ItemService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Podio .NET/Services/ItemService.cs b/Source/Podio .NET/Services/ItemService.cs index 2122b65..c46ab32 100644 --- a/Source/Podio .NET/Services/ItemService.cs +++ b/Source/Podio .NET/Services/ItemService.cs @@ -188,7 +188,7 @@ public async Task AddNewItem(int appId, Item item, int? spaceId = null, bo /// 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() @@ -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() @@ -723,7 +723,7 @@ public async System.Threading.Tasks.Task UpdateItemReference(long 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); From 9612e241e431c86331b5c17bea384974e99c3fa8 Mon Sep 17 00:00:00 2001 From: Michael Marziani Date: Thu, 21 Jul 2022 19:23:14 +0200 Subject: [PATCH 4/7] Additional int to long changes in Comment service Also fixes build problem by adding ArrayToCSV overload for a long[]. --- Source/Podio .NET/Services/CommentService.cs | 4 ++-- Source/Podio .NET/Utils/Utilities.cs | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/Podio .NET/Services/CommentService.cs b/Source/Podio .NET/Services/CommentService.cs index e8a4a4e..fd0f650 100644 --- a/Source/Podio .NET/Services/CommentService.cs +++ b/Source/Podio .NET/Services/CommentService.cs @@ -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); @@ -108,7 +108,7 @@ 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); 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) From b061c5f959cf2ef15778a79e20317626b88c8697 Mon Sep 17 00:00:00 2001 From: Michael Marziani Date: Thu, 21 Jul 2022 19:40:24 +0200 Subject: [PATCH 5/7] One more int to long in the Comment service --- Source/Podio .NET/Services/CommentService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Podio .NET/Services/CommentService.cs b/Source/Podio .NET/Services/CommentService.cs index fd0f650..db05664 100644 --- a/Source/Podio .NET/Services/CommentService.cs +++ b/Source/Podio .NET/Services/CommentService.cs @@ -76,7 +76,7 @@ public async Task> GetCommentsOnObject(string type, long 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) { From 3e41562319e8abb9ea07a22e7605b783511daa24 Mon Sep 17 00:00:00 2001 From: Michael Marziani Date: Tue, 7 Mar 2023 17:44:50 +0100 Subject: [PATCH 6/7] More comment id int -> long --- .gitignore | 3 ++- Source/Podio .NET/Models/Comment.cs | 2 +- Source/Podio .NET/Services/CommentService.cs | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) 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/Services/CommentService.cs b/Source/Podio .NET/Services/CommentService.cs index db05664..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); @@ -76,7 +76,7 @@ public async Task> GetCommentsOnObject(string type, long id) /// /// todo: describe hook parameter on AddCommentToObject /// - public async Task AddCommentToObject(string type, long 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, long id, string text, str /// /// todo: describe hook parameter on AddCommentToObject /// - public async Task AddCommentToObject(string type, long 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, long id, CommentCreateUpd /// 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); From 5fd6979807ddc0eb4d1b91381f6eb683db74e6dc Mon Sep 17 00:00:00 2001 From: Michael Marziani Date: Tue, 7 Mar 2023 18:10:37 +0100 Subject: [PATCH 7/7] Fix to comment.ref.id unable to parse as int --- Source/Podio .NET/Models/Reference.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }