Async bindings to Pocket API (https://getpocket.com).
Note down the POCKET_CONSUMER_KEY you can find in Pocket's "My
Applications" dashboard. Retrieve a POCKET_AUTHORIZATION_CODE for your
POCKET_CONSUMER_KEY by running the examples/auth.rs
example program and following the instructions.
POCKET_CONSUMER_KEY="<your-pocket-consumer-key>" cargo run --example authSet and export the variables in your shell for convenience:
export POCKET_CONSUMER_KEY="<your-pocket-consumer-key>"
export POCKET_AUTHORIZATION_CODE="<your-pocket-authorization-code>"This library integrates with the log logging façade crate. You can get
debug information by prepending RUST_LOG=DEBUG to executable invocations that
use this library, like the example programs or the tests. For example, to run
all tests with debug information and backtraces:
RUST_LOG=DEBUG RUST_BACKTRACE=1 cargo testThese might prove useful to debug HTTP responses, or to interact with Pocket's API directly in shell script without having to use this library (they are using HTTPie):
http https://getpocket.com/v3/get \
consumer_key="$POCKET_CONSUMER_KEY" \
access_token="$POCKET_AUTHORIZATION_CODE" \
state=all \
detailType=complete \
search="Ana Vidovic"
http https://getpocket.com/v3/send \
consumer_key="$POCKET_CONSUMER_KEY" \
access_token="$POCKET_AUTHORIZATION_CODE" \
actions=[{action="add", time=0, url="https://www.rust-lang.org/"}]
http https://getpocket.com/v3/send < json_document.jsonSee Pocket's API documentation for more endpoints and parameters.
To run the unit tests, you need to have POCKET_CONSUMER_KEY set.
cargo test --libTo run the integration tests, you need to have both POCKET_CONSUMER_KEY and
POCKET_AUTHORIZATION_CODE set. Additionally, your Pocket account needs to:
- have the URL https://getpocket.com/developer/docs/v3/modify#action_archive in its reading list; and
- have the items
pdf.json,blog.json,video.json, andhttps://getpocket.com/developer/docs/v3/modify#action_archivein its reading list (including their tags). Note that the timestamps and identifiers are from my Pocket test account, so you will have to change those after recreating the items in your account.
cargo test --test integration_tests- Bruno Tavares for pickpocket.