Bluesky
view release on metacpan or search on metacpan
lib/Bluesky.pod view on Meta::CPAN
=back
=head2 C<oauth_start( $handle, $client_id, $redirect_uri, [ $scope ] )>
Initiates the OAuth 2.0 Authorization Code flow. Returns the authorization URL.
my $url = $bsky->oauth_start(
'user.bsky.social',
'http://localhost',
'http://127.0.0.1:8888/callback'
);
=head2 C<oauth_callback( $code, $state )>
Exchanges the authorization code for tokens and completes the OAuth flow.
$bsky->oauth_callback( $code, $state );
=head2 C<oauth_helper( %args )>
A high-level helper to manage the entire OAuth flow. This is the recommended way to authenticate for interactive
applications.
$bsky->oauth_helper(
handle => 'user.bsky.social',
listen => 1,
on_success => sub ($self) {
say 'Authenticated as ' . $self->did;
}
);
Expected parameters include:
=over
=item C<handle> - required
The user's handle or DID.
=item C<listen>
Boolean. If true, attempts to start a local HTTP server (using L<Mojolicious::Lite>) to automatically capture the
C<code> and C<state> from the redirect.
=item C<redirect>
The redirect URI. Defaults to C<http://127.0.0.1:8888/callback>.
=item C<scope>
The requested OAuth scopes. Defaults to C<atproto chat.bsky.convo>.
=item C<on_success>
A callback subroutine invoked after a successful login. Receives the C<$bsky> object as an argument.
=back
=head2 C<firehose( $callback, [ $url ] )>
Returns a new L<At::Protocol::Firehose> client for real-time streaming.
my $fh = $bsky->firehose(sub ($header, $body, $err) { ... });
$fh->start();
See L<At::Protocol::Firehose> for more details.
=head1 Feed and Content
Methods in this category create, modify, access, and delete content.
=head2 C<getTrendingTopics( [...] )>
$bsky->getTrendingTopics( );
Get a list of trending topics.
Expected parameters include:
=over
=item C<viewer>
DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed
accounts in ranking.
=item C<limit>
Integer.
Default: C<10>, Minimum: C<1>, Maximum: C<25>.
=back
=head2 C<getTimeline( [...] )>
$bsky->getTimeline();
Get a view of the requesting account's home timeline. This is expected to some form of reverse-chronological feed.
Expected parameters include:
=over
=item C<algorithm>
Variant 'algorithm' for timeline. Implementation-specific.
NOTE: most feed flexibility has been moved to feed generator mechanism.
=item C<limit>
Integer.
Default: C<50>, Minimum: C<1>, Maximum: C<100>.
=item C<cursor>
=back
=head2 C<getFeed( ... )>
( run in 0.328 second using v1.01-cache-2.11-cpan-5b529ec07f3 )