Pocketeer v0.1.4 Pocketeer.Item
Builds structs for use with the Modify API, to modify items.
The Pocket API allows to modify multiple items at once in a bulk operation. For this several Item
actions can be created directly or chained via pipe operator.
Note an Item
struct then can be used with the Pocketeer.send/2
functions to modify items.
Examples
# single action
iex> Item.archive("1234")
%{action: "archive", item_id: "1234"}
# multiple items of same action
iex> Item.favorite(["abcd", "9876"])
[%{action: "favorite", item_id: "abcd"}, %{action: "favorite", item_id: "9876"}]
# chained list of actions, can be combined as wished
iex> items = Item.new |> Item.favorite("2") |> Item.delete("3")
%Item{actions: [%{action: "favorite", item_id: "2"}, %{action: "delete", item_id: "3"}]}
iex> items.actions
[%{action: "favorite", item_id: "2"}, %{action: "delete", item_id: "3"}]
Summary
Functions
Returns a struct for adding an item to Pocket with an url
or an item_id
Used to return a new list from the existing item
Archives the given item or items
Deletes the given item or items
Marks the given item or items as favorite
Renames a tag, note this affects all items that have this tag
Adds one or more tags to an item
Removes all tags from an item
Removes one or more tags from an item
Replaces all of the tags of an item with the new tag or list of tags
Readds or unarchives the given item or items
Removes fav / unfavorites the given item or items
Types
t :: %Pocketeer.Item{actions: list}
A list of actions that can be send via Pocketeer.send/2
Functions
Returns a struct for adding an item to Pocket with an url
or an item_id
.
Parameters
options
- A map of options, requiresurl
oritem_id
to be present. Accepts the same parameters as thePocketeer.Add
module.
Examples
iex> Item.add(%{url: "http://hex.pm"})
%{action: "add", url: "http://hex.pm"}
iex> Item.add(%{item_id: "1234"})
%{action: "add", item_id: "1234"}
Used to return a new list from the existing item
Parameters
item
- aPocketeer.Item
struct with optionsid
- the item id
Examples
iex> Item.new |> Item.add(%{url: "http://foo.com"})
%Item{actions: [%{action: "add", url: "http://foo.com"}]}