NAME

WWW::Pocket - Wrapper for the Pocket v3 API

VERSION

version 0.03

SYNOPSIS

  use WWW::Pocket;

  my $pocket = WWW::Pocket->new(
      # get a consumer key at https://getpocket.com/developer/
      consumer_key => '...',
  );

  my ($url, $code) = $pocket->start_authentication('https://example.com/');
  # visit $url, log in
  $pocket->finish_authentication($code);

  say for map { $_->{resolved_url} } values %{ $pocket->retrieve->{list} };

DESCRIPTION

This module wraps the Pocket v3 API. To use, you must first authenticate via OAuth by providing a valid consumer key, and then visiting the OAuth endpoint (handled by the start_authentication and finish_authentication methods). Once logged in, you can interact with the API via the add, modify, and retrieve methods, which correspond to the endpoints documented at https://getpocket.com/developer/docs/overview.

This module also ships with a command line scripts called pocket, for interacting with the API from the command line. See the documentation for that script for more details.

ATTRIBUTES

consumer_key

The consumer key for your application. You can generate a consumer key at https://getpocket.com/developer/apps/. Required.

access_token

The token returned when you successfully authenticate. This can be used to reauthenticate with the server without having to log in every time. It is set automatically by finish_authentication, but can also be provided directly to avoid having to reauthenticate. It is required to be set before any API methods are called.

username

The username that you have authenticated as. It is set automatically by finish_authentication, and can also be provided directly. It is informational only.

base_uri

The base URI for the Pocket service. Defaults to https://getpocket.com/.

api_base_uri

The base URI for the API endpoints. Defaults to appending /v3/ to the base_uri.

auth_base_uri

The base URI for the authentication endpoints. Defaults to appending /auth/ to the base_uri.

ua

The HTTP::Tiny instance used to access the api.

METHODS

start_authentication($redirect_uri)

Call this method to begin the authentication process. You must provide the $redirect_uri, which is where the user will be redirected to after authenticating. This method returns a URL and an authentication code. The user must visit the URL to log into Pocket and approve the application, and then you should call finish_authentication with the authentication code after that is done.

finish_authentication($code)

Finishes the authentication process. Call this method with the code returned by start_authentication after the user has visited the URL which was also returned by start_authentication. Once this method returns, the access_key and username attributes will be set, and other API methods can be successfully called.

add(%params)

Wraps the add endpoint. %params can include any parameters documented in the API documentation.

modify

Wraps the modify endpoint. %params can include any parameters documented in the API documentation.

retrieve

Wraps the retrieve endpoint. %params can include any parameters documented in the API documentation.

BUGS

No known bugs.

Please report any bugs to GitHub Issues at https://github.com/doy/www-pocket/issues.

SEE ALSO

Webservice::Pocket for the v2 API

SUPPORT

You can find this documentation for this module with the perldoc command.

    perldoc WWW::Pocket

You can also look for information at:

AUTHOR

Jesse Luehrs <doy@tozt.net>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2016 by Jesse Luehrs.

This is free software, licensed under:

  The MIT (X11) License