The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::OperaLink - a Perl interface to the My Opera Community API

SYNOPSIS

Example:

    use Net::OperaLink;

    my $link = Net::OperaLink->new(
        consumer_key => '{your-consumer-key-here}',
        consumer_secret => '{your-consumer-secret-here}',
    );

    if (! $link->authorized) {

        print "I need authorization at: ", $link->get_authorization_url, "\n";
        print "then type the verifier + ENTER to continue\n";

        chomp (my $verifier = <STDIN>);

        my ($access_token, $access_token_secret) = $link->request_access_token(verifier => $verifier);

        # and save your precious access token + secret somewhere
    }

    my $bookmarks = $link->bookmarks();
    my $speeddials = $link->speeddials();
    my $notes = $link->notes();

    my $single_bookmark = $link->bookmark('{bookmark-id}');

    # ...

In reality, it's a bit more complicated than that, but look at the complete example script provided in examples/link-api-example. That should work out of the box, and provide you with a nice base to build upon.

DESCRIPTION

This module will be useful to you if you use the Opera Browser (http://www.opera.com/download/) and you use its Opera Link feature.

What is Opera Link?

Opera Link is a convenient way to share browser information between computers and devices, so you always have it with you, wherever you go.

With most devices, you can synchronize custom search engines and typed history. Any Web-site address you have typed in one device will be available in your other computers or mobile phones running Opera.

Opera Link synchronizes your:

Bookmarks
Speed Dial
Personal bar
Notes
Typed browser history
Custom searches

The Opera Link API is a REST API that will let you access your own Opera Link data.

The official Opera Link API documentation is up at http://www.opera.com/docs/apis/linkrest/.

How the module works

If you know how Net::Twitter works, then you will have no problem using Net::OperaLink because it behaves in the same way, also based on OAuth.

If you're not familiar with OAuth, go to http://oauth.net and read the documentation there. There's also some very nice tutorials out there, such as:

http://dev.opera.com/articles/view/gentle-introduction-to-oauth/

and others of course.

To use this module, you will need your set of OAuth API keys. To get your own OAuth consumer key and secret, you need to go to:

https://auth.opera.com/service/oauth/

where you will be able to sign up to the My Opera Community and create your own application and get your set of consumer keys.

SUBROUTINES/METHODS

CLASS CONSTRUCTOR

new( %args )

Class constructor.

There's two, both mandatory, arguments, consumer_key and consumer_secret.

Example:

    my $link = Net::OperaLink->new(
        consumer_key => '...',
        consumer_secret => '...',
    );

To get your own consumer key and secret, you need to head over to:

https://auth.opera.com/service/oauth/

where you will be able to sign up to the My Opera Community and create your own application and get your set of consumer keys.

bookmarks()

notes()

speeddials()

These three methods retrieve the entire tree of your bookmarks, notes and speeddials respectively.

You will get back an array ref, where each element of the array is a hash. See the included examples/link-api-example script for a working example.

bookmark($id)

bookmark($id, $query_type)

note($id)

note($id, $query_type)

speeddial($id)

speeddial($id, $query_type)

Retrieves data for a single bookmark (or note or speeddial).

You need to specify the bookmark id. Typically you do this when you have already loaded a subtree of bookmarks and you know already the id.

This is useful together with query type ($query_type) on those datatypes that are structured in folders (bookmarks and notes for now), so you can get all the subentries and subfolders of a bookmark for example.

There's 2 allowed values for $query_type:

children

Gets the 1st level children of the node (or root)

descendants or recurse

Gets all the descendants of a node. Using descendants on a data type that doesn't support it (f.ex. speeddials) is not going to work, so don't do it.

access_token()

access_token($new_value)

access_token_secret()

access_token_secret($new_value)

consumer_key()

consumer_key($new_value)

consumer_secret()

consumer_secret($new_value)

request_token()

request_token($new_value)

request_token_secret()

request_token_secret($value)

All of these are simple accessors/mutators, to store access token and secret data. This store is volatile. It doesn't get saved on disk or database.

authorized()

Returns true if you already have a valid access token that's also authorized. If not, you will need to get a request token. You need to be familiar with the OAuth protocol flow. Refer to http://oauth.net/.

get_authorization_url()

Returns the URL that a user can use to authorize the request token. Under the hood, it first requests a new request token.

oauth_url_for($oauth_phase)

oauth_url_for($oauth_phase, %arguments)

Internal method to generate URLs towards the Opera OAuth server.

request_access_token( verifier = $verifier )>

When the request token is authorized by the user, the user will be given a "verifier" code. You need to have the user input the verifier code, and use it for this method.

In case of success, this method will return you both the OAuth access token and access token secret, which you will be able to use to finally perform the API requests, namely status update.

request_request_token()

Requests and returns a new request token. First step of the OAuth flow. You can use this method also to quickly check that your set of API keys work as expected.

If they don't work, the method will croak (die badly with an error message).

AUTHORS

Cosimo Streppone, <cosimo@opera.com>

BUGS

Please report any bugs or feature requests to bug-net-operalink at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-OperaLink. We will be notified, and then you'll automatically be notified of progress on your bug as we make changes.

SEE ALSO

http://www.opera.com/docs/apis/linkrest/

SUPPORT

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

    perldoc Net::OperaLink

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright (c), 2010 Opera Software ASA. All rights reserved.

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 548:

alternative text 'http://dev.opera.com/articles/view/introducing-the-opera-link-api/' contains non-escaped | or /

Around line 550:

alternative text 'http://dev.opera.com/articles/view/building-your-first-link-api-application/' contains non-escaped | or /

Around line 552:

alternative text 'http://dev.opera.com/articles/view/gentle-introduction-to-oauth/' contains non-escaped | or /