podio / podio-dotnet

Podio .NET client
MIT License
19 stars 39 forks source link

Feature request: Update items by appItemId and appId #35

Open LUS1N opened 7 years ago

LUS1N commented 7 years ago

Disclaimer: I do understand that the podio api might be a limitation on this one.

I ran into this problem, that by only having AppItemId and not the global ItemId I can't run the update command so easily.

I made it out that I need to fetch the item first by calling GetItemByAppItemId(appId, appItemId) and then using the ItemId from the returned object.

When the returned item is big I couldn't even use the returned object in updating and had to extract the ItemId and make a new object with the value like so (although I agree that this is better when updating 1 field, it shouldn't be forced):

var item = new Item
{
    ItemId = podio.ItemService.GetItemByAppItemId(appId, appItemId).ItemId
};
item.Field<TextItemField>("my_field").Value = "-1";
podio.ItemService.UpdateItem(item, null, null, true);

Which could be done in the same way as in geting by app item id's

var item = new Item {AppItemId = appItemId};
item.Field<TextItemField>("my_field").Value = "-1";
podio.ItemService.UpdateItem(appId, item);

That would avoid the unnecessary GetItem call, but would require additional explanation that AppItemId is a required field of Item when calling this method.

Cheers!