Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change item id from int to long #59

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ obj
Source/packages/*

Source/.vs/*
project.lock.json
project.lock.json
/.vs
2 changes: 1 addition & 1 deletion Source/Podio .NET/Models/Comment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion Source/Podio .NET/Models/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion Source/Podio .NET/Models/Reference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
16 changes: 8 additions & 8 deletions Source/Podio .NET/Services/CommentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public CommentService(Podio currentInstance)
/// <para>Podio API Reference: https://developers.podio.com/doc/comments/delete-a-comment-22347 </para>
/// </summary>
/// <param name="commentId"></param>
public async Task<dynamic> DeleteComment(int commentId)
public async Task<dynamic> DeleteComment(long commentId)
{
string url = string.Format("/comment/{0}", commentId);
return await _podio.Delete<dynamic>(url);
Expand All @@ -32,7 +32,7 @@ public async Task<dynamic> DeleteComment(int commentId)
/// </summary>
/// <param name="commentId"></param>
/// <returns></returns>
public async Task<Comment> GetComment(int commentId)
public async Task<Comment> GetComment(long commentId)
{
string url = string.Format("/comment/{0}", commentId);
return await _podio.Get<Comment>(url);
Expand All @@ -46,7 +46,7 @@ public async Task<Comment> GetComment(int commentId)
/// <param name="type"></param>
/// <param name="id"></param>
/// <returns></returns>
public async Task<List<Comment>> GetCommentsOnObject(string type, int id)
public async Task<List<Comment>> GetCommentsOnObject(string type, long id)
{
string url = string.Format("/comment/{0}/{1}/", type, id);
return await _podio.Get<List<Comment>>(url);
Expand Down Expand Up @@ -76,7 +76,7 @@ public async Task<List<Comment>> GetCommentsOnObject(string type, int id)
/// </param>
/// <param name="hook">todo: describe hook parameter on AddCommentToObject</param>
/// <returns></returns>
public async Task<int> AddCommentToObject(string type, int id, string text, string externalId = null,
public async Task<long> AddCommentToObject(string type, long id, string text, string externalId = null,
List<int> fileIds = null, string embedUrl = null, int? embedId = null, bool alertInvite = false,
bool silent = false, bool hook = true)
{
Expand Down Expand Up @@ -108,13 +108,13 @@ public async Task<int> AddCommentToObject(string type, int id, string text, stri
/// </param>
/// <param name="hook">todo: describe hook parameter on AddCommentToObject</param>
/// <returns></returns>
public async Task<int> AddCommentToObject(string type, int id, CommentCreateUpdateRequest comment, bool alertInvite = false,
public async Task<long> 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<dynamic>(url, comment);
return (int) response["comment_id"];
return (long) response["comment_id"];
}

/// <summary>
Expand All @@ -131,7 +131,7 @@ public async Task<int> 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
/// </param>
public async Task<dynamic> UpdateComment(int commentId, string text, string externalId = null, List<int> fileIds = null,
public async Task<dynamic> UpdateComment(long commentId, string text, string externalId = null, List<int> fileIds = null,
string embedUrl = null, int? embedId = null)
{
var requestData = new CommentCreateUpdateRequest()
Expand All @@ -151,7 +151,7 @@ public async Task<dynamic> UpdateComment(int commentId, string text, string ext
/// </summary>
/// <param name="commentId"></param>
/// <param name="comment"></param>
public async Task<dynamic> UpdateComment(int commentId, CommentCreateUpdateRequest comment)
public async Task<dynamic> UpdateComment(long commentId, CommentCreateUpdateRequest comment)
{
string url = string.Format("/comment/{0}", commentId);
return await _podio.Put<dynamic>(url, comment);
Expand Down
48 changes: 24 additions & 24 deletions Source/Podio .NET/Services/ItemService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ItemService(Podio currentInstance)
/// </param>
/// <param name="hook">If set to false, hooks will not be executed for the change</param>
/// <returns>Id of the created item</returns>
public async Task<int> AddNewItem(int appId, Item item, int? spaceId = null, bool silent = false, bool hook = true)
public async Task<long> 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 }));

Expand Down Expand Up @@ -188,7 +188,7 @@ public async Task<int> 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
/// </param>
public async Task<Item> GetItem(int itemId, bool markedAsViewed = true)
public async Task<Item> GetItem(long itemId, bool markedAsViewed = true)
{
string markAsViewdValue = markedAsViewed == true ? "1" : "0";
var requestData = new Dictionary<string, string>()
Expand All @@ -210,7 +210,7 @@ public async Task<Item> GetItem(int itemId, bool markedAsViewed = true)
/// notifications untouched, Default value true
/// </param>
/// <returns></returns>
public async Task<Item> GetItemBasic(int itemId, bool markedAsViewed = true)
public async Task<Item> GetItemBasic(long itemId, bool markedAsViewed = true)
{
string viewedVal = markedAsViewed == true ? "1" : "0";
var requestData = new Dictionary<string, string>()
Expand Down Expand Up @@ -357,12 +357,12 @@ public async Task<BulkDeletionStatus> BulkDeleteItems(int appId, BulkDeleteReque
/// generated
/// </param>
/// <returns>The id of the cloned item</returns>
public async Task<int> CloneItem(int itemId, bool silent = false)
public async Task<long> 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<dynamic>(url);
return int.Parse(tw["item_id"].ToString());
return long.Parse(tw["item_id"].ToString());
}

/// <summary>
Expand All @@ -375,7 +375,7 @@ public async Task<int> CloneItem(int itemId, bool silent = false)
/// generated
/// </param>
/// <param name="hook">If set to false, hooks will not be executed for the change</param>
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));
Expand All @@ -387,7 +387,7 @@ public async System.Threading.Tasks.Task DeleteItem(int itemId, bool silent = fa
/// <para>Podio API Reference: https://developers.podio.com/doc/items/delete-item-reference-7302326 </para>
/// </summary>
/// <param name="itemId"></param>
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<dynamic>(url);
Expand Down Expand Up @@ -472,7 +472,7 @@ public async Task<PodioCollection<Item>> FilterItemsByView(int appId, int viewId
/// <param name="limit">The maximum number of results to return Default value: 13</param>
/// <param name="notItemIds">If supplied the items with these ids will not be returned</param>
/// <returns></returns>
public async Task<List<Item>> GetTopValuesByField(int fieldId, int limit = 13, int[] notItemIds = null)
public async Task<List<Item>> GetTopValuesByField(int fieldId, int limit = 13, long[] notItemIds = null)
{
string itemIdCSV = Utility.ArrayToCSV(notItemIds);
var requestData = new Dictionary<string, string>()
Expand Down Expand Up @@ -509,7 +509,7 @@ public async Task<AppValues> GetAppValues(int appId)
/// <param name="itemId"></param>
/// <param name="fieldId"></param>
/// <returns></returns>
public async Task<T> GetItemFieldValues<T>(int itemId, int fieldId) where T : new()
public async Task<T> GetItemFieldValues<T>(long itemId, int fieldId) where T : new()
{
string url = string.Format("/item/{0}/value/{1}", itemId, fieldId);
return await _podio.Get<T>(url);
Expand All @@ -522,7 +522,7 @@ public async Task<AppValues> GetAppValues(int appId)
/// <param name="itemId"></param>
/// <param name="fieldId"></param>
/// <returns></returns>
public async Task<Item> GetItemBasicByField(int itemId, string fieldId)
public async Task<Item> GetItemBasicByField(long itemId, string fieldId)
{
string url = string.Format("/item/{0}/reference/{1}/preview", itemId, fieldId);
return await _podio.Get<Item>(url);
Expand All @@ -535,7 +535,7 @@ public async Task<Item> GetItemBasicByField(int itemId, string fieldId)
/// </summary>
/// <param name="itemId"></param>
/// <returns></returns>
public async Task<List<ItemReference>> GetItemReferences(int itemId)
public async Task<List<ItemReference>> GetItemReferences(long itemId)
{
string url = string.Format("/item/{0}/reference/", itemId);
return await _podio.Get<List<ItemReference>>(url);
Expand Down Expand Up @@ -573,7 +573,7 @@ public async Task<Range> GetFieldRanges(int fieldId)
/// </summary>
/// <param name="itemId"></param>
/// <returns></returns>
public async Task<List<ItemField>> GetItemValues(int itemId)
public async Task<List<ItemField>> GetItemValues(long itemId)
{
string url = string.Format("/item/{0}/value", itemId);
return await _podio.Get<List<ItemField>>(url);
Expand All @@ -585,7 +585,7 @@ public async Task<List<ItemField>> GetItemValues(int itemId)
/// </summary>
/// <param name="itemId"></param>
/// <returns></returns>
public async Task<ItemRevision> GetItemRevision(int itemId, int revision)
public async Task<ItemRevision> GetItemRevision(long itemId, int revision)
{
string url = string.Format("/item/{0}/revision/{1}", itemId, revision);
return await _podio.Get<ItemRevision>(url);
Expand All @@ -597,7 +597,7 @@ public async Task<ItemRevision> GetItemRevision(int itemId, int revision)
/// </summary>
/// <param name="itemId"></param>
/// <returns></returns>
public async Task<List<ItemRevision>> GetItemRevisions(int itemId)
public async Task<List<ItemRevision>> GetItemRevisions(long itemId)
{
string url = string.Format("/item/{0}/revision/", itemId);
return await _podio.Get<List<ItemRevision>>(url);
Expand All @@ -610,7 +610,7 @@ public async Task<List<ItemRevision>> GetItemRevisions(int itemId)
/// </summary>
/// <param name="itemId"></param>
/// <returns></returns>
public async Task<string> GetMeetingUrl(int itemId)
public async Task<string> GetMeetingUrl(long itemId)
{
string url = string.Format("/item/{0}/meeting/url", itemId);
dynamic response = await _podio.Get<dynamic>(url);
Expand All @@ -626,7 +626,7 @@ public async Task<string> GetMeetingUrl(int itemId)
/// </summary>
/// <param name="itemId"></param>
/// <param name="status">The new status, either "invited", "accepted", "declined" or "tentative"</param>
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
{
Expand All @@ -644,7 +644,7 @@ public async System.Threading.Tasks.Task SetParticipation(int itemId, string sta
/// <param name="fieldId"></param>
/// <param name="limit"></param>
/// <returns></returns>
public async Task<List<ItemMicro>> GetReferencesToItemByField(int itemId, int fieldId, int limit = 20)
public async Task<List<ItemMicro>> GetReferencesToItemByField(long itemId, int fieldId, int limit = 20)
{
var requestData = new Dictionary<string, string>()
{
Expand All @@ -661,7 +661,7 @@ public async Task<List<ItemMicro>> GetReferencesToItemByField(int itemId, int fi
/// <param name="itemId"></param>
/// <param name="type">The type of the reference</param>
/// <param name="id">The id of the reference</param>
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
{
Expand All @@ -680,7 +680,7 @@ public async System.Threading.Tasks.Task UpdateItemReference(int itemId, string
/// <param name="itemId"></param>
/// <param name="revisionId"></param>
/// <returns>The id of the new revision</returns>
public async Task<int?> RevertItemRevision(int itemId, int revisionId)
public async Task<int?> RevertItemRevision(long itemId, int revisionId)
{
var url = string.Format("/item/{0}/revision/{1}", itemId, revisionId);
var response = await _podio.Delete<dynamic>(url);
Expand All @@ -698,7 +698,7 @@ public async System.Threading.Tasks.Task UpdateItemReference(int itemId, string
/// <param name="itemId"></param>
/// <param name="revision"></param>
/// <returns>revision</returns>
public async Task<int?> RevertToRevision(int itemId, int revision)
public async Task<int?> RevertToRevision(long itemId, int revision)
{
var url = string.Format("/item/{0}/revision/{1}/revert_to", itemId, revision);
var response = await _podio.Delete<dynamic>(url);
Expand All @@ -723,7 +723,7 @@ public async System.Threading.Tasks.Task UpdateItemReference(int itemId, string
/// </param>
/// <param name="text">The text to search for. The search will be lower case, and with a wildcard in each end.</param>
/// <returns></returns>
public async Task<List<Item>> FindReferenceableItems(int fieldId, int limit = 13, int[] notItemIds = null,
public async Task<List<Item>> FindReferenceableItems(int fieldId, int limit = 13, long[] notItemIds = null,
string sort = null, string text = null)
{
string itemIdCSV = Utility.ArrayToCSV(notItemIds);
Expand All @@ -744,7 +744,7 @@ public async Task<List<Item>> FindReferenceableItems(int fieldId, int limit = 13
/// </summary>
/// <param name="itemId"></param>
/// <returns></returns>
public async Task<Clone> GetItemClone(int itemId)
public async Task<Clone> GetItemClone(long itemId)
{
string url = string.Format("/item/{0}/clone", itemId);
return await _podio.Get<Clone>(url);
Expand All @@ -758,13 +758,13 @@ public async Task<Clone> GetItemClone(int itemId)
/// <param name="revisionFrom"></param>
/// <param name="revisionTo"></param>
/// <returns></returns>
public async Task<List<ItemDiff>> GetItemRevisionDifference(int itemId, int revisionFrom, int revisionTo)
public async Task<List<ItemDiff>> GetItemRevisionDifference(long itemId, int revisionFrom, int revisionTo)
{
string url = string.Format("/item/{0}/revision/{1}/{2}", itemId, revisionFrom, revisionTo);
return await _podio.Get<List<ItemDiff>>(url);
}

public async Task<ItemCalculate> Calcualate(int itemId, ItemCalculateRequest ItemCalculateRequest, int limit = 30)
public async Task<ItemCalculate> 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);
Expand Down
8 changes: 8 additions & 0 deletions Source/Podio .NET/Utils/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down