Skip to content

Commit

Permalink
Checking in changes prior to tagging of version 0.03.
Browse files Browse the repository at this point in the history
Changelog diff is:

diff --git a/Changes b/Changes
index a52b870..a13d3fc 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,10 @@ Revision history for Perl extension App-bsky
 
 {{$NEXT}}
 
+0.03 2024-01-27T23:46:20Z
+
+    - Commands for app passwords, likes, reposts, invite codes, threads, etc.
+
 0.02 2024-01-26T19:00:52Z
 
     - Less broken session management
  • Loading branch information
sanko committed Jan 27, 2024
1 parent 155df62 commit ed00bca
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 69 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Revision history for Perl extension App-bsky

{{$NEXT}}

0.03 2024-01-27T23:46:20Z

- Commands for app passwords, likes, reposts, invite codes, threads, etc.

0.02 2024-01-26T19:00:52Z

- Less broken session management
Expand Down
4 changes: 2 additions & 2 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
},
"runtime" : {
"requires" : {
"At" : "0.14",
"At" : "0.15",
"File::HomeDir" : "0",
"Getopt::Long" : "0",
"JSON::Tiny" : "0",
Expand Down Expand Up @@ -88,7 +88,7 @@
"web" : "https://github.com/sanko/App-bsky"
}
},
"version" : "0.02",
"version" : "0.03",
"x_authority" : "cpan:SANKO",
"x_serialization_backend" : "JSON::PP version 4.16",
"x_static_install" : 1
Expand Down
46 changes: 15 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Display posts from timeline.
## thread

```
thread at://did:plc:qdvyf5jhuxqx667ay7k7nagl/app.bsky.feed.post/3kju327qezs2n
thread at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w
```

Show a thread.
Expand All @@ -150,65 +150,55 @@ Create a new post.
## like

```
bsky like [uri]
bsky like at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w
```

Like a post.

TODO

### Options
## unlike

```
uri
bsky unlike at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w
bsky unlike at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.like/3kjyml72tqu2y
```

Unlike a post. Either the direct feed URI or the like URI printed by `bsky like ...`.

## likes

```
bsky likes [uri]
bsky likes at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w
```

Show likes on a post.

TODO

### Options

```
uri
--json boolean flag; content is printed as JSON objects if given
```

## repost

```
bsky repost [uri]
bsky repost at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w
```

Repost the post.

TODO

### Options

```
uri
```

## reposts

```
bsky reposts [uri]
bsky reposts at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w
```

Show reposts of the post.

TODO

### Options

```
uri
--json boolean flag; content is printed as JSON objects if given
```

## follow
Expand Down Expand Up @@ -342,16 +332,10 @@ Show blocks.
## delete

```
bsky delete [cid]
bsky delete at://did:p...
```

Delete an item.

### Options

```
cid
```
Delete a post, repost, etc.

## notifications

Expand Down
2 changes: 1 addition & 1 deletion cpanfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
requires 'perl', '5.038000'; # class syntax
requires 'At', '0.14';
requires 'At', '0.15';
requires 'Getopt::Long';
requires 'Pod::Text::Color';
requires 'Path::Tiny';
Expand Down
27 changes: 21 additions & 6 deletions lib/App/bsky.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package App::bsky 0.02 {
package App::bsky 0.03 {
use v5.38;
use utf8;
use Bluesky;
Expand Down Expand Up @@ -301,8 +301,6 @@ package App::bsky 0.02 {
}
method cmd_like ($uri) { # can take the post uri
#~ GetOptionsFromArray( \@args, 'json!' => \my $json );
my $res = $bsky->like($uri);
$res // return;
$self->say( $res->{uri}->as_string );
Expand Down Expand Up @@ -336,11 +334,28 @@ package App::bsky 0.02 {
}
method cmd_repost ($uri) {
...;
my $res = $bsky->repost($uri);
$res // return;
$self->say( $res->{uri}->as_string );
}
method cmd_reposts ($uri) {
...;
method cmd_reposts ( $uri, @args ) {
GetOptionsFromArray( \@args, 'json!' => \my $json );
my @reposts;
my $cursor = ();
do {
my $reposts = $bsky->feed_getRepostedBy( $uri, undef, 100, $cursor );
push @reposts, @{ $reposts->{repostedBy} };
$cursor = $reposts->{cursor};
} while ($cursor);
if ($json) {
$self->say( JSON::Tiny::to_json [ map { $_->_raw } @reposts ] );
}
else {
$self->say( '%s%s%s%s', color('red'), $_->handle->_raw, color('reset'), defined $_->displayName ? ' [' . $_->displayName . ']' : '' )
for @reposts;
}
scalar @reposts;
}
method cmd_follow ($actor) { # takes handle or did
Expand Down
40 changes: 14 additions & 26 deletions script/bsky
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Display posts from timeline.

=head2 thread

thread at://did:plc:qdvyf5jhuxqx667ay7k7nagl/app.bsky.feed.post/3kju327qezs2n
thread at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w

Show a thread.

Expand All @@ -130,51 +130,43 @@ Create a new post.

=head2 like

bsky like [uri]
bsky like at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w

Like a post.

TODO
=head2 unlike

=head3 Options
bsky unlike at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w

bsky unlike at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.like/3kjyml72tqu2y

uri
Unlike a post. Either the direct feed URI or the like URI printed by C<bsky like ...>.

=head2 likes

bsky likes [uri]
bsky likes at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w

Show likes on a post.

TODO

=head3 Options

uri
--json boolean flag; content is printed as JSON objects if given

=head2 repost

bsky repost [uri]
bsky repost at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w

Repost the post.

TODO

=head3 Options

uri

=head2 reposts

bsky reposts [uri]
bsky reposts at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post/3kjyoh75qne2w

Show reposts of the post.

TODO

=head3 Options

uri
--json boolean flag; content is printed as JSON objects if given

=head2 follow

Expand Down Expand Up @@ -278,13 +270,9 @@ Show blocks.

=head2 delete

bsky delete [cid]

Delete an item.

=head3 Options
bsky delete at://did:p...

cid
Delete a post, repost, etc.

=head2 notifications

Expand Down
11 changes: 8 additions & 3 deletions t/01_client.t
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ subtest 'live' => sub {
like is_say { client->run(qw[unblock sankor.bsky.social]) }, qr[at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.graph.block],
'unblock sankor.bsky.social';
};
subtest 'post/delete' => sub {
subtest 'post/like/repost/reposts/delete' => sub {
like my $uri = is_say { client->run(qw[post Demo]) }, qr[at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.post], 'post Demo';
sleep 1; # sometimes the service has to catch up
ok client->run( 'like', $uri ), 'like at://...';
Expand All @@ -171,15 +171,20 @@ subtest 'live' => sub {
sleep 1;
ok client->run( 'like', $uri ), 'like at://...';
sleep 1;
ok client->run( 'delete', $uri ), 'delete at://...';
like my $repost = is_say { client->run( 'repost', $uri ) }, qr[at://did:plc:pwqewimhd3rxc4hg6ztwrcyj/app.bsky.feed.repost],
'repost at://';
sleep 1;
like is_say { client->run( 'reposts', $uri, '--json' ) }, qr[atperl.bsky.social], 'reposts at://... --json';
ok client->run( 'delete', $repost ), 'delete at://... [delete repost]';
ok client->run( 'delete', $uri ), 'delete at://... [delete post]';
};
like is_say { client->run(qw[thread at://did:plc:qdvyf5jhuxqx667ay7k7nagl/app.bsky.feed.post/3kju327qezs2n]) },
qr[did:plc:qvzn322kmcvd7xtnips5xaun], 'thread at://...';
like is_say { client->run(qw[thread at://did:plc:qdvyf5jhuxqx667ay7k7nagl/app.bsky.feed.post/3kju327qezs2n --json]) }, qr[^{],
'thread --json at://...';
like is_say { client->run(qw[list-app-passwords]) }, qr[Test Suite - bsky], 'list-app-passwords';
like is_say { client->run(qw[list-app-passwords --json]) }, qr[^\[\{], 'list-app-passwords --json';
like is_say { client->run(qw[notifications]) }, qr[did:plc:pwqewimhd3rxc4hg6ztwrcyj], 'notifications';
like is_say { client->run(qw[notifications]) }, qr[did:plc:], 'notifications';
like is_say { client->run(qw[notifications --json]) }, qr[^\[\{], 'notifications --json';
like is_say { client->run(qw[show-session]) }, qr[did:plc:pwqewimhd3rxc4hg6ztwrcyj], 'show-session';
like is_say { client->run(qw[show-session --json]) }, qr[^{], 'show-session --json';
Expand Down

0 comments on commit ed00bca

Please sign in to comment.