Package com.podio.item
Class ItemAPI
- java.lang.Object
-
- com.podio.BaseAPI
-
- com.podio.item.ItemAPI
-
public class ItemAPI extends BaseAPI
Items are entries in an app. If you think of app as a table, items will be the rows in the table. Items consists of some basic information as well values for each of the fields in the app. For each field there can be multiple values (F.ex. there can be multiple links to another app) and multiple types of values (F.ex. a field of type date field consists of both a start date and an optional end date). The type is denoted by an string id called a sub_id. Most types of fields have only one type, which is denoted by the sub_id values. Others have multiple sub_ids.
-
-
Constructor Summary
Constructors Constructor Description ItemAPI(ResourceFactory resourceFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddItem(int appId, ItemCreate create, boolean silent)Adds a new item to the given app.voiddeleteItem(int itemId, boolean silent)Deletes an item and removes it from all views.ItemsResponsefilterItems(int appId, ItemFilter filter)ItemgetItem(int itemId)Gets the item with the given idList<Map<String,Object>>getItemFieldValues(int itemId, int fieldId)Returns the values for a specified field on an itemList<ItemReference>getItemReference(int itemId)Returns the items that have a reference to the given item.ItemRevisiongetItemRevision(int itemId, int revisionId)Returns the data about the specific revision on an itemList<ItemFieldDifference>getItemRevisionDifference(int itemId, int revisionFrom, int revisionTo)Returns the difference in fields values between the two revisions.List<ItemRevision>getItemRevisions(int itemId)Returns all the revisions that have been made to an itemItemsResponsegetItems(int appId, Integer limit, Integer offset, SortBy sortBy, Boolean sortDesc, FilterByValue<?>... filters)Returns the items on app matching the given filters.ItemsResponsegetItemsByExternalId(int appId, String externalId)Utility method to get items matching an external idList<ItemMini>getItemsByFieldAndTitle(int fieldId, String text, List<Integer> notItemIds, Integer limit)Used to find possible items for a given application field.List<FieldValuesView>getItemValues(int itemId)Returns all the values for an item, with the additional data provided by the get item operation.voidupdateItem(int itemId, ItemUpdate update, boolean silent, boolean hook)Updates the entire item.voidupdateItemFieldValues(int itemId, int fieldId, List<Map<String,String>> values, boolean silent, boolean hook)Update the item values for a specific field.voidupdateItemValues(int itemId, List<FieldValuesUpdate> values, boolean silent, boolean hook)Updates all the values for an item-
Methods inherited from class com.podio.BaseAPI
getResourceFactory
-
-
-
-
Constructor Detail
-
ItemAPI
public ItemAPI(ResourceFactory resourceFactory)
-
-
Method Detail
-
addItem
public int addItem(int appId, ItemCreate create, boolean silent)Adds a new item to the given app.- Parameters:
appId- The id of the app the item should be added tocreate- The data for the new itemsilent- True if the create should be silten, false otherwise- Returns:
- The id of the newly created item
-
getItem
public Item getItem(int itemId)
Gets the item with the given id- Parameters:
itemId- The id of the item- Returns:
- The item with given id
-
updateItem
public void updateItem(int itemId, ItemUpdate update, boolean silent, boolean hook)Updates the entire item. Only fields which have values specified will be updated. To delete the contents of a field, pass an empty array for the value.- Parameters:
itemId- The id of the item to updateupdate- The data for the updatesilent- True if the update should be silent, false otherwisehook- True if hooks should be executed for the change, false otherwise
-
updateItemValues
public void updateItemValues(int itemId, List<FieldValuesUpdate> values, boolean silent, boolean hook)Updates all the values for an item- Parameters:
itemId- The id of the itemvalues- The values for the fieldssilent- True if the update should be silent, false otherwisehook- True if hooks should be executed for the change, false otherwise
-
updateItemFieldValues
public void updateItemFieldValues(int itemId, int fieldId, List<Map<String,String>> values, boolean silent, boolean hook)Update the item values for a specific field.- Parameters:
itemId- The id of the itemfieldId- The id of the fieldvalues- The new values for the fieldsilent- True if the update should be silent, false otherwisehook- True if hooks should be executed for the change, false otherwise
-
deleteItem
public void deleteItem(int itemId, boolean silent)Deletes an item and removes it from all views. The data can no longer be retrieved.- Parameters:
itemId- The id of the itemsilent- True if the deletion should be silent, false otherwise
-
getItemFieldValues
public List<Map<String,Object>> getItemFieldValues(int itemId, int fieldId)
Returns the values for a specified field on an item- Parameters:
itemId- The id of the itemfieldId- The id of the field- Returns:
- The values on the field on the item
-
getItemValues
public List<FieldValuesView> getItemValues(int itemId)
Returns all the values for an item, with the additional data provided by the get item operation.- Parameters:
itemId- The id of the item- Returns:
- The values on the item
-
getItemsByFieldAndTitle
public List<ItemMini> getItemsByFieldAndTitle(int fieldId, String text, List<Integer> notItemIds, Integer limit)
Used to find possible items for a given application field. It searches the relevant items for the title given.- Parameters:
fieldId- The id of app reference field to search fortext- The text to search for in the items titlenotItemIds- If supplied the items with these ids will not be returnedlimit- The maximum number of results to return. Default value: 13- Returns:
- The items that were valid for the field and with text matching
-
getItemReference
public List<ItemReference> getItemReference(int itemId)
Returns the items that have a reference to the given item. The references are grouped by app. Both the apps and the items are sorted by title.- Parameters:
itemId- The id of the item- Returns:
- The references to the given item
-
getItemRevision
public ItemRevision getItemRevision(int itemId, int revisionId)
Returns the data about the specific revision on an item- Parameters:
itemId- The id of the itemrevisionId- The running revision number, starts at 0 for the initial revision- Returns:
- The revision
-
getItemRevisionDifference
public List<ItemFieldDifference> getItemRevisionDifference(int itemId, int revisionFrom, int revisionTo)
Returns the difference in fields values between the two revisions.- Parameters:
itemId- The id of the itemrevisionFrom- The from revisionrevisionTo- The to revision- Returns:
- The difference between the two revision
-
getItemRevisions
public List<ItemRevision> getItemRevisions(int itemId)
Returns all the revisions that have been made to an item- Parameters:
itemId- The id of the item- Returns:
- All the revisions
-
filterItems
public ItemsResponse filterItems(int appId, ItemFilter filter)
-
getItems
public ItemsResponse getItems(int appId, Integer limit, Integer offset, SortBy sortBy, Boolean sortDesc, FilterByValue<?>... filters)
Returns the items on app matching the given filters.- Parameters:
appId- The id of the applimit- The maximum number of items to receive, defaults to 20offset- The offset from the start of the items returned, defaults to 0sortBy- How the items should be sorted. For the possible options, see the filter area.sortDesc-trueor leave out to sort descending, usefalseto sort ascendingfilters- The filters to apply- Returns:
- The items matching the filters
-
getItemsByExternalId
public ItemsResponse getItemsByExternalId(int appId, String externalId)
Utility method to get items matching an external id- Parameters:
appId- The id of the appexternalId- The external id- Returns:
- The items matching the app and external id
-
-