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

Types

t()

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

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

add(options)

Returns a struct for adding an item to Pocket with an url or an item_id.

Parameters

  • options - A map of options, requires url or item_id to be present. Accepts the same parameters as the Pocketeer.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"}
add(item, options)

Specs

add(t, map) :: t

Used to return a new list from the existing item

Parameters

Examples

iex> Item.new |> Item.add(%{url: "http://foo.com"})
%Item{actions: [%{action: "add", url: "http://foo.com"}]}
archive(id)

Archives the given item or items.

archive(item, id)
delete(item_id)

Deletes the given item or items.

delete(item, id)
favorite(item_id)

Marks the given item or items as favorite.

favorite(item, id)
new()
new(action)
tag_rename(old_tag, new_tag)

Renames a tag, note this affects all items that have this tag.

tag_rename(item, old_tag, new_tag)
tags_add(item_id, tags)

Adds one or more tags to an item.

tags_add(item, id, tags)
tags_clear(item_id)

Removes all tags from an item.

tags_clear(item, id)
tags_remove(item_id, tags)

Removes one or more tags from an item.

tags_remove(item, id, tags)
tags_replace(item_id, tags)

Replaces all of the tags of an item with the new tag or list of tags

tags_replace(item, id, tags)
unarchive(item_id)

Readds or unarchives the given item or items.

unarchive(item, id)
unfavorite(item_id)

Removes fav / unfavorites the given item or items.

unfavorite(item, id)