Title: | Wrapper Around the 'Pocket' API |
---|---|
Description: | Functions that interface with the 'Pocket' API (<https://getpocket.com/developer/>). Allows the user to get, add, and modify items in their own 'Pocket' account. |
Authors: | Frie Preu [aut, cre], Yannik Buhl [aut], Max Alletsee [aut], Dorian Le Jeune [ctb], Christoph Dworschak [ctb], Sarah Jukna [ctb], CorrelAid e.V. [cph] |
Maintainer: | Frie Preu <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1 |
Built: | 2024-11-19 05:12:13 UTC |
Source: | https://github.com/correlaid/pocketapi |
Creates the URL the user needs to enter into her browser in order to authorize the Pocket application/the request token.
create_authorize_url(request_token)
create_authorize_url(request_token)
request_token |
Character string. Pocket request token generated by the function |
See the GitHub README for details on Authentication.
Character string. The URL for authorizing the Pocket application for which the request token was requested. This is what you enter into your browser.
Other authentication functions:
get_access_token()
,
get_request_token()
Creates the URL the user needs to enter into her browser in order to authorize the Pocket application/the request token.
get_access_token(consumer_key, request_token)
get_access_token(consumer_key, request_token)
consumer_key |
Character string. Here goes your Pocket consumer key. |
request_token |
Character string. Pocket request token generated by |
See the GitHub README for details on Authentication.
Character string. Returns the access token.
Other authentication functions:
create_authorize_url()
,
get_request_token()
Requests a request_token for the Pocket application with a given consumer key from the Pocket Authentication API. The request token can then be used in create_authorize_url
and get_access_token
.
get_request_token(consumer_key)
get_request_token(consumer_key)
consumer_key |
Character string. Here goes your Pocket consumer key. |
See the GitHub README for details on Authentication.
Character string. Request token for the Pocket Application corresponding to your consumer_key.
Other authentication functions:
create_authorize_url()
,
get_access_token()
Add one or more items to your Pocket account.
pocket_add( add_urls, item_ids = "", tags = NULL, success = TRUE, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
pocket_add( add_urls, item_ids = "", tags = NULL, success = TRUE, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
add_urls |
Character vector. The URL or URLs you want to add to your Pocket list. |
item_ids |
Character vector. The item_ids of the items you want to add. Defaults to empty character vector. |
tags |
Character vector. One or more tags to be applied to all of the newly added URLs. Defaults to NULL. |
success |
Logical. Enables success/failure messages for every URL. Defaults to TRUE. Needs GET permission if TRUE. |
consumer_key |
Character string. Your Pocket consumer key. Defaults to |
access_token |
Character string. Your Pocket request token. Defaults to |
This function uses the modify
endpoint of the Pocket API which exhibits some weird behaviour.
For example, even if a 'modify' action is not successful, the API will still return "success".
See [issue [#26](https://github.com/CorrelAid/pocketapi/issues/26) for a discussion.
the response from the httr call, invisibly
archive items from your Pocket list.
pocket_archive( item_ids, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
pocket_archive( item_ids, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
item_ids |
character vector. Pocket item ids you want to archive. |
consumer_key |
character. Your Pocket consumer key. Defaults to Sys.getenv("POCKET_CONSUMER_KEY"). |
access_token |
character. Your Pocket request token. Defaults to Sys.getenv("POCKET_ACCESS_TOKEN"). |
This function uses the modify
endpoint of the Pocket API which exhibits some weird behaviour.
For example, even if a 'modify' action is not successful, the API will still return "success".
See [issue [#26](https://github.com/CorrelAid/pocketapi/issues/26) for a discussion.
Invisibly returns a list containing information on whether the action failed or succeeded, including the respective item ID.
delete items from your Pocket list.
pocket_delete( item_ids, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
pocket_delete( item_ids, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
item_ids |
character vector. Pocket item ids you want to delete from your list. |
consumer_key |
character. Your Pocket consumer key. Defaults to Sys.getenv("POCKET_CONSUMER_KEY"). |
access_token |
character. Your Pocket request token. Defaults to Sys.getenv("POCKET_ACCESS_TOKEN"). |
This function uses the modify
endpoint of the Pocket API which exhibits some weird behaviour.
For example, even if a 'modify' action is not successful, the API will still return "success".
See [issue [#26](https://github.com/CorrelAid/pocketapi/issues/26) for a discussion.
Invisibly returns a list containing information on whether the action failed or succeeded, including the respective item ID.
favorite items from your Pocket list.
pocket_favorite( item_ids, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
pocket_favorite( item_ids, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
item_ids |
character vector. Pocket item ids you want to favorite |
consumer_key |
character. Your Pocket consumer key. Defaults to Sys.getenv("POCKET_CONSUMER_KEY"). |
access_token |
character. Your Pocket request token. Defaults to Sys.getenv("POCKET_ACCESS_TOKEN"). |
This function uses the modify
endpoint of the Pocket API which exhibits some weird behaviour.
For example, even if a 'modify' action is not successful, the API will still return "success".
See [issue [#26](https://github.com/CorrelAid/pocketapi/issues/26) for a discussion.
Invisibly returns a list containing information on whether the action failed or succeeded, including the respective item ID.
Get a data frame with your pocket data.
pocket_get( favorite = NULL, item_type = NULL, tag = NULL, state = "all", consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
pocket_get( favorite = NULL, item_type = NULL, tag = NULL, state = "all", consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
favorite |
boolean. Default NULL. Allows to filter for favorited items. If TRUE, only favorited items will be returned. If FALSE, only un-favorited items will be returned. |
item_type |
character. Default NULL. Allows to filter for content type of items. Valid values are: "image", "article", "video". Please note that there might be Pocket items that do not belong to any of those types. The Pocket API documentation only mentions those three. |
tag |
character. Default NULL. Only one tag can be filtered at a time. Set to '_untagged_' if you only want to get untagged items. |
state |
character. Default "all". Allows to filter on unread/archived items or return all. Valid values are "unread", "archive", "all". |
consumer_key |
character. Your Pocket consumer key. Defaults to Sys.getenv("POCKET_CONSUMER_KEY"). |
access_token |
character. Your Pocket request token. Defaults to Sys.getenv("POCKET_ACCESS_TOKEN"). |
See https://getpocket.com/developer/docs/v3/retrieve for the meaning of certain variable values.
tibble. Tibble with one row for each Pocket item.
Function that sends a request with a list of actions to the 'modify' Pocket API endpoint.
pocket_modify( actions, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
pocket_modify( actions, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
actions |
List. List of lists where each element is an action object. See https://getpocket.com/developer/docs/v3/modify. |
consumer_key |
Character string. Your Pocket consumer key. Defaults to |
access_token |
Character string. Your Pocket request token. Defaults to |
see https://getpocket.com/developer/docs/v3/modify. This function uses the modify
endpoint of the Pocket API which exhibits some weird behaviour.
For example, even if a 'modify' action is not successful, the API will still return "success".
See [issue [#26](https://github.com/CorrelAid/pocketapi/issues/26) for a discussion.
modify the tags of the items in pocket.
pocket_tag( action_name = c("tags_replace", "tags_remove", "tags_add", "tags_clear", "tag_rename", "tag_delete"), item_ids = NULL, tags = NULL, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
pocket_tag( action_name = c("tags_replace", "tags_remove", "tags_add", "tags_clear", "tag_rename", "tag_delete"), item_ids = NULL, tags = NULL, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
action_name |
character vector. The kind of tag action you want to undertake. Possible values: 'tags_add', 'tags_remove', 'tags_replace', 'tags_clear', 'tag_rename', or 'tag_delete'. |
item_ids |
character vector. Pocket item ids you want to modify the tags for. |
tags |
character vector. The names of the tags to work with the chosen action. |
consumer_key |
character. Your Pocket consumer key. Defaults to Sys.getenv("POCKET_CONSUMER_KEY"). |
access_token |
character. Your Pocket request token. Defaults to Sys.getenv("POCKET_ACCESS_TOKEN"). |
This function uses the modify
endpoint of the Pocket API which exhibits some weird behaviour.
For example, even if a 'modify' action is not successful, the API will still return "success".
See [issue [#26](https://github.com/CorrelAid/pocketapi/issues/26) for a discussion.
Unfavorite items from your Pocket list.
pocket_unfavorite( item_ids, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
pocket_unfavorite( item_ids, consumer_key = Sys.getenv("POCKET_CONSUMER_KEY"), access_token = Sys.getenv("POCKET_ACCESS_TOKEN") )
item_ids |
Character vector. Pocket item IDs you want to unfavorite. Get them, e.g., via |
consumer_key |
character. Your Pocket consumer key. Defaults to Sys.getenv("POCKET_CONSUMER_KEY"). |
access_token |
character. Your Pocket request token. Defaults to Sys.getenv("POCKET_ACCESS_TOKEN"). |
This function uses the modify
endpoint of the Pocket API which exhibits some weird behaviour.
For example, even if a 'modify' action is not successful, the API will still return "success".
See [issue [#26](https://github.com/CorrelAid/pocketapi/issues/26) for a discussion.
Invisibly returns a list containing information on whether the action failed or succeeded, including the respective item ID.