| 1 | 6 | ▶ | use v5.40; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use feature 'class'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | no warnings 'experimental::class', 'experimental::try'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | class Bluesky v1.8.0 { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Carp qw[carp]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use At; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use Path::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use HTTP::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use URI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use URI::Escape; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | ▶ | use JSON::PP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | field $service : param //= 'https://bsky.social'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 6 | field $chat_service : param //= 'https://api.bsky.chat'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 6 | field $video_service : param : reader //= 'https://video.bsky.app'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 6 | field $at : reader = At->new( host => $service ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 103 | ▶ | method _at_for ($method) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_at_for: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 103 | ▶ | if ( $method =~ /^chat\.bsky\./ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # Chat requests are proxied via the PDS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # Service ID fragment (#bsky_chat) is required. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 20 | ▶ | say '[DEBUG] [Bluesky] Proxying chat request...' if $ENV{DEBUG}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 20 | $self->at->http->at_protocol_proxy('did:web:api.bsky.chat#bsky_chat'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 20 | return $at; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # Ensure proxy is NOT used for standard repo/feed calls | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 83 | $self->at->http->at_protocol_proxy(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 83 | return $at; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | method login ( $identifier, $password ) { $self->at->login( $identifier, $password ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
login: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | ▶ | method resume( $accessJwt, $refreshJwt, $token_type = 'Bearer', $dpop_key_jwk = (), $client_id = (), $handle = (), $pds = (), $scope = () ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resume: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 4 | $self->at->resume( $accessJwt, $refreshJwt, $token_type, $dpop_key_jwk, $client_id, $handle, $pds, $scope ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | ▶ | method oauth_start( $handle, $client_id, $redirect_uri, $scope = 'atproto' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oauth_start: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | return $self->at->oauth_start( $handle, $client_id, $redirect_uri, $scope ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | ▶ | method oauth_callback( $code, $state ) { return $self->at->oauth_callback( $code, $state ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oauth_callback: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | method oauth_helper (%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oauth_helper: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | my $handle = $args{handle} or die 'Handle is required for oauth_helper'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # client_id base MUST be localhost for the PDS to recognize it as metadata-less | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | my $client_id_base = $args{client_id} // 'http://localhost'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"client_id"} // "http://localhost"
MC/DC0%0/1
$args{"client_id"} // "http://localhost"
$args{"client_id"}
Truth table0%0/2
A
A= $args{"client_id"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # RFC 8252 requires loopback IP (127.0.0.1) for the actual redirect | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | my $redirect_uri = $args{redirect} // 'http://127.0.0.1:8888/callback'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"redirect"} // "http://127.0.0.1:8888/callback"
MC/DC0%0/1
$args{"redirect"} // "http://127.0.0.1:8888/callback"
$args{"redirect"}
Truth table0%0/2
A
A= $args{"redirect"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | # Transitional scopes for chat access via PDS proxy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | my $scope = $args{scope} // 'atproto'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"scope"} // "atproto"
MC/DC0%0/1
$args{"scope"} // "atproto"
$args{"scope"}
Truth table0%0/2
A
A= $args{"scope"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | my $on_success = $args{on_success} // sub {1}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Condition0%0/3
$args{"on_success"} // sub {
1;
}
MC/DC0%0/2
$args{"on_success"} // sub {
1;
}
$args{"on_success"}
sub {
1;
}
Truth table0%0/3
A // B
A= $args{"on_success"}B= sub {
1;
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # Build the magic localhost Client ID manually to ensure %20 encoding for spaces | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | require URI::Escape; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | my $scope_encoded = URI::Escape::uri_escape($scope); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my $redirect_encoded = URI::Escape::uri_escape($redirect_uri); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my $client_id = "$client_id_base?scope=$scope_encoded&redirect_uri=$redirect_encoded"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | say "Starting OAuth flow for $handle..."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my $auth_url = $self->oauth_start( $handle, $client_id, $redirect_uri, $scope ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | say 'Please open the following URL in your browser:'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | say "\n $auth_url\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if ( $args{listen} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # Attempt to start a local server to catch the callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | try { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | require Mojolicious; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my $app = Mojolicious->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my $port = 8888; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my $daemon; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | $port = $1 if $redirect_uri =~ /:(\d+)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | my $path = URI->new($redirect_uri)->path || '/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
'URI'->new($redirect_uri)->path || '/'
MC/DC0%0/1
'URI'->new($redirect_uri)->path || '/'
'URI'->new($redirect_uri)->path
Truth table0%0/2
A
A= 'URI'->new($redirect_uri)->path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | $app->routes->get($path)->to( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | cb => sub ($c) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my $code = $c->param('code'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my $state = $c->param('state'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | if ( $code && $state ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$code and $state
MC/DC0%0/2
$code and $state
$code
$state
Truth table0%0/3
A and B
A= $codeB= $state
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | say 'Exchanging code for tokens...'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | try { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $self->oauth_callback( $code, $state ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | $on_success->($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $c->render( text => '<h1>Success!</h1><p>You can close this window and return to the terminal.</p>' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # Stop loop after response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | require Mojo::IOLoop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | Mojo::IOLoop->timer( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | 1 => sub { $daemon->stop if defined $daemon; Mojo::IOLoop->stop if Mojo::IOLoop->can('stop'); } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | catch ($e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | $c->render( text => 'OAuth Callback failed: ' . $e, status => 500 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | die $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | $c->render( text => 'Error: Missing code or state.', status => 400 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | say "Starting local server on port $port to catch the callback..."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | $app->log->level('error'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | require Mojo::Server::Daemon; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # Listen on all interfaces but specific to the redirect_uri port | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $daemon = Mojo::Server::Daemon->new( app => $app, listen => [ 'http://127.0.0.1:' . $port ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $daemon->run(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | return $self; # Listener ran (blocks until finished); control returns after stop | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | catch ($e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | warn "Could not start listener: $e\nFalling back to manual input.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | # Manual fallback (only reached if listen is false or failed) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | say 'After authorizing, you will be redirected to a URL that looks like:'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | say "$redirect_uri?code=...&state=..."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | say "\nPlease paste the FULL redirect URL here:"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $callback_url = <STDIN>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | chomp $callback_url; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my ($code) = $callback_url =~ /[?&]code=([^&]+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my ($state) = $callback_url =~ /[?&]state=([^&]+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if ( $code && $state ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$code and $state
MC/DC0%0/2
$code and $state
$code
$state
Truth table0%0/3
A and B
A= $codeB= $state
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $self->oauth_callback( $code, $state ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $on_success->($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | die "Could not find code and state in the provided URL.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | ▶ | method firehose( $callback, $url = () ) { $self->at->firehose( $callback, $url ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
firehose: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | ▶ | method session () { $self->at->session; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
session: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 1 | ▶ | method did() { $self->at->did } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
did: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | # Session persistence | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 8 | ▶ | method save_session ( $file = 'session.json' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
save_session: called CC=12 SCAR=31.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 8 | my $session = $self->at->session; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 8 | ▶ | if ( !$session ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 1 | carp 'No active session to save'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 7 | my $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 7 | ▶ | if ( builtin::blessed $session ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 1 | try { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 1 | my $raw = $session->_raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 1 | ▶ | if ( ref($raw) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 1 | $data = {%$raw}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | elsif ( defined $raw ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # maybe it returned something odd, try list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my @kvs = $session->_raw(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | $data = {@kvs} if scalar @kvs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | catch ($e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $data = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 1 | ▶ | if ( !$data ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | try { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $data = +{ $session->_raw }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | catch ($e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $data = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | ▶ | $data ||= {%$session}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$data ||= {%$session}
MC/DC0%0/1
$data ||= {%$session}
$data
Truth table50%1/2
A
A= $data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | elsif ( ref($session) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 6 | $data = {%$session}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 7 | ▶ | unless ($data) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | carp 'Cannot serialize session of type ' . ( ref $session || 'non-reference' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
ref $session || 'non-reference'
MC/DC0%0/1
ref $session || 'non-reference'
ref $session
Truth table0%0/2
A
A= ref $session
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 7 | path($file)->spew_raw( JSON::PP->new->ascii->pretty->allow_nonref->encode($data) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 7 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 5 | ▶ | method load_session ( $file = 'session.json' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_session: called CC=9 SCAR=23.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 5 | ▶ | return unless -e $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 4 | my $config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 4 | try { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 4 | $config = JSON::PP::decode_json( path($file)->slurp_raw ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | catch ($e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 3 | ▶ | return unless $config && ref($config) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$config and ref $config eq "HASH"
MC/DC0%0/2
$config and ref $config eq "HASH"
$config
ref $config eq "HASH"
Truth table33%1/3
A and B
A= $configB= ref $config eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 3 | my $result = $self->resume( map { $config->{$_} } qw[accessJwt refreshJwt token_type dpop_key_jwk client_id handle pds scope] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | # resume() consumes the one-time-use refresh token whenever the access | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | # token has expired. Write the rotated session back so the next run does | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # not replay the spent token (which would force a fresh interactive login). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 3 | ▶ | if ( $result && !$self->_session_is_error($result) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$result and not $self->_session_is_error($result)
MC/DC0%0/2
$result and not $self->_session_is_error($result)
$result
not $self->_session_is_error($result)
Truth table33%1/3
A and not(B)
A= $resultB= not $self->_session_is_error($result)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 3 | my $active = eval { $self->at->session }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 3 | ▶ | if ( $active && !$self->_session_is_error($active) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$active and not $self->_session_is_error($active)
MC/DC0%0/2
$active and not $self->_session_is_error($active)
$active
not $self->_session_is_error($active)
Truth table33%1/3
A and not(B)
A= $activeB= not $self->_session_is_error($active)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 3 | try { $self->save_session($file) } catch ($e) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 3 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 3 | ▶ | method ensure_auth (%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ensure_auth: called CC=11 SCAR=25.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 3 | ▶ | my $file = $args{file} // 'session.json'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"file"} // "session.json"
MC/DC0%0/1
$args{"file"} // "session.json"
$args{"file"}
Truth table50%1/2
A
A= $args{"file"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 3 | my $handle = $args{handle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 3 | ▶ | my $scope = $args{scope} // 'atproto'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"scope"} // "atproto"
MC/DC100%1/1
$args{"scope"} // "atproto"
$args{"scope"}
Truth table100%2/2
A
A= $args{"scope"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 3 | ▶ | if ( -e $file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 1 | my $ok = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 1 | try { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 1 | $self->load_session($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 1 | $ok = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | catch ($e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $ok = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 1 | my $probe; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 1 | try { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | $probe = $self->at->session; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | catch ($e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | $probe = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 1 | ▶ | if ( $ok && $probe && !$self->_session_is_error($probe) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$ok and $probe and not $self->_session_is_error($probe)
$ok and $probe
MC/DC0%0/3
$ok and $probe and not $self->_session_is_error($probe)
$ok
$probe
not $self->_session_is_error($probe)
Truth table25%1/4
A and B and not(C)
A= $okB= $probeC= not $self->_session_is_error($probe)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | # resume() already rotated expired tokens; persist the current session | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | try { $self->save_session($file) } catch ($e) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 2 | ▶ | $handle or die 'ensure_auth: no saved session found and no handle given; pass handle => "you.bsky.social" for first-time auth'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 1 | ▶ | my %helper = ( handle => $handle, scope => $scope, listen => $args{listen} // 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"listen"} // 1
MC/DC0%0/1
$args{"listen"} // 1
$args{"listen"}
Truth table50%1/2
A
A= $args{"listen"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 1 | ▶ | $helper{client_id} = $args{client_id} if defined $args{client_id}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 1 | ▶ | $helper{redirect} = $args{redirect} if defined $args{redirect}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1 | ▶ | $helper{on_success} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 1 | $self->save_session($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 1 | ▶ | $args{on_success}->($self) if $args{on_success}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 1 | $self->oauth_helper(%helper); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 7 | ▶ | method _session_is_error ($session) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_session_is_error: called CC=4 SCAR=25.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 7 | ▶ | return 0 unless builtin::blessed $session; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | return 1 if $session->can('isa') && $session->isa('At::Error'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$session->can("isa") and $session->isa("At::Error")
MC/DC0%0/2
$session->can("isa") and $session->isa("At::Error")
$session->can("isa")
$session->isa("At::Error")
Truth table0%0/3
A and B
A= $session->can("isa")B= $session->isa("At::Error")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | # Feeds and content | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | method getTrendingTopics(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getTrendingTopics: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $self->_at_for('app.bsky.unspecced.getTrendingTopics')->get( 'app.bsky.unspecced.getTrendingTopics' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 1 | ▶ | method getTimeline(%args) { $self->_at_for('app.bsky.feed.getTimeline')->get( 'app.bsky.feed.getTimeline' => \%args ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getTimeline: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 1 | ▶ | method getAuthorFeed(%args) { $self->_at_for('app.bsky.feed.getAuthorFeed')->get( 'app.bsky.feed.getAuthorFeed' => \%args ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getAuthorFeed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 1 | ▶ | method getPostThread(%args) { $self->_at_for('app.bsky.feed.getPostThread')->get( 'app.bsky.feed.getPostThread' => \%args ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPostThread: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 1 | ▶ | method getFeed( $feed, %args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getFeed: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | my $res = $self->_at_for('app.bsky.feed.getFeed')->get( 'app.bsky.feed.getFeed' => { feed => $feed, %args } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | ▶ | $res ? $res->{feed} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"feed"} // ()
MC/DC0%0/2
$res->{"feed"} // ()
$res->{"feed"}
()
Truth table33%1/3
A // B
A= $res->{"feed"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | ▶ | method getFeedSkeleton( $feed, %args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getFeedSkeleton: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | my $res = $self->_at_for('app.bsky.feed.getFeedSkeleton')->get( 'app.bsky.feed.getFeedSkeleton' => { feed => $feed, %args } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 1 | ▶ | $res ? $res->{feed} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"feed"} // ()
MC/DC0%0/2
$res->{"feed"} // ()
$res->{"feed"}
()
Truth table33%1/3
A // B
A= $res->{"feed"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 1 | ▶ | method getListFeed( $list, %args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getListFeed: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 1 | my $res = $self->_at_for('app.bsky.feed.getListFeed')->get( 'app.bsky.feed.getListFeed' => { list => $list, %args } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | ▶ | $res ? $res->{feed} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"feed"} // ()
MC/DC0%0/2
$res->{"feed"} // ()
$res->{"feed"}
()
Truth table33%1/3
A // B
A= $res->{"feed"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 1 | ▶ | method sendInteractions(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sendInteractions: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 1 | $self->_at_for('app.bsky.feed.sendInteractions')->post( 'app.bsky.feed.sendInteractions' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 3 | ▶ | method getPost($uri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPost: called CC=4 SCAR=15.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 3 | ▶ | my $res = $self->_at_for('app.bsky.feed.getPosts') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | ->get( 'app.bsky.feed.getPosts' => { uris => [ builtin::blessed $uri ? $uri->as_string : $uri ] } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 3 | ▶ | $res ? $res->{posts}[0] // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"posts"}[0] // ()
MC/DC0%0/2
$res->{"posts"}[0] // ()
$res->{"posts"}[0]
()
Truth table33%1/3
A // B
A= $res->{"posts"}[0]B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 1 | ▶ | method getPosts(@uris) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPosts: called CC=4 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | my $res = $self->_at_for('app.bsky.feed.getPosts') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 1 | ▶ | ->get( 'app.bsky.feed.getPosts' => { uris => [ map { builtin::blessed $_ ? $_->as_string : $_ } @uris ] } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 1 | ▶ | $res ? $res->{posts} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"posts"} // ()
MC/DC0%0/2
$res->{"posts"} // ()
$res->{"posts"}
()
Truth table33%1/3
A // B
A= $res->{"posts"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 1 | ▶ | method getLikes(%args) { $self->_at_for('app.bsky.feed.getLikes')->get( 'app.bsky.feed.getLikes' => \%args ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getLikes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 1 | ▶ | method getBookmarks(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getBookmarks: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 1 | my $res = $self->_at_for('app.bsky.bookmark.getBookmarks')->get( 'app.bsky.bookmark.getBookmarks' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 1 | ▶ | $res ? $res->{bookmarks} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"bookmarks"} // ()
MC/DC0%0/2
$res->{"bookmarks"} // ()
$res->{"bookmarks"}
()
Truth table33%1/3
A // B
A= $res->{"bookmarks"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 1 | ▶ | method createBookmark( $uri, $cid //= () ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createBookmark: called CC=4 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 1 | ▶ | if ( !defined $cid ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 1 | my $post = $self->_at_for('app.bsky.feed.getPosts')->get( 'app.bsky.feed.getPosts' => { uris => [$uri] } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 1 | ▶ | $post || $post->throw; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 1 | $cid = $post->{posts}[0]{cid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 1 | $self->_at_for('app.bsky.bookmark.createBookmark')->post( 'app.bsky.bookmark.createBookmark' => { uri => $uri, cid => $cid } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 1 | ▶ | method deleteBookmark($uri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deleteBookmark: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 1 | $self->_at_for('app.bsky.bookmark.deleteBookmark')->post( 'app.bsky.bookmark.deleteBookmark' => { uri => $uri } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | ▶ | method getQuotes(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getQuotes: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | my $res = $self->_at_for('app.bsky.feed.getQuotes')->get( 'app.bsky.feed.getQuotes' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 1 | ▶ | $res ? $res->{quotes} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"quotes"} // ()
MC/DC0%0/2
$res->{"quotes"} // ()
$res->{"quotes"}
()
Truth table33%1/3
A // B
A= $res->{"quotes"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 1 | ▶ | method getActorLikes(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getActorLikes: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 1 | my $res = $self->_at_for('app.bsky.feed.getActorLikes')->get( 'app.bsky.feed.getActorLikes' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 1 | ▶ | $res ? $res->{feed} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"feed"} // ()
MC/DC0%0/2
$res->{"feed"} // ()
$res->{"feed"}
()
Truth table33%1/3
A // B
A= $res->{"feed"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 1 | ▶ | method searchPosts(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
searchPosts: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 1 | my $res = $self->_at_for('app.bsky.feed.searchPosts')->get( 'app.bsky.feed.searchPosts' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 1 | ▶ | $res ? $res->{posts} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"posts"} // ()
MC/DC0%0/2
$res->{"posts"} // ()
$res->{"posts"}
()
Truth table33%1/3
A // B
A= $res->{"posts"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 1 | ▶ | method getSuggestedFeeds(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getSuggestedFeeds: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 1 | my $res = $self->_at_for('app.bsky.feed.getSuggestedFeeds')->get( 'app.bsky.feed.getSuggestedFeeds' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 1 | ▶ | $res ? $res->{feeds} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"feeds"} // ()
MC/DC0%0/2
$res->{"feeds"} // ()
$res->{"feeds"}
()
Truth table33%1/3
A // B
A= $res->{"feeds"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 1 | ▶ | method describeFeedGenerator() { $self->_at_for('app.bsky.feed.describeFeedGenerator')->get('app.bsky.feed.describeFeedGenerator') } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
describeFeedGenerator: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 1 | ▶ | method getFeedGenerator($generator) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getFeedGenerator: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 1 | $self->_at_for('app.bsky.feed.getFeedGenerator')->get( 'app.bsky.feed.getFeedGenerator' => { feed => $generator } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 1 | ▶ | method getFeedGenerators(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getFeedGenerators: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | my $res = $self->_at_for('app.bsky.feed.getFeedGenerators')->get( 'app.bsky.feed.getFeedGenerators' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 1 | ▶ | $res ? $res->{feeds} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"feeds"} // ()
MC/DC0%0/2
$res->{"feeds"} // ()
$res->{"feeds"}
()
Truth table33%1/3
A // B
A= $res->{"feeds"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 1 | ▶ | method getActorFeeds(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getActorFeeds: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 1 | my $res = $self->_at_for('app.bsky.feed.getActorFeeds')->get( 'app.bsky.feed.getActorFeeds' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 1 | ▶ | $res ? $res->{feeds} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"feeds"} // ()
MC/DC0%0/2
$res->{"feeds"} // ()
$res->{"feeds"}
()
Truth table33%1/3
A // B
A= $res->{"feeds"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 1 | ▶ | method getRepostedBy(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getRepostedBy: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 1 | my $res = $self->_at_for('app.bsky.feed.getRepostedBy')->get( 'app.bsky.feed.getRepostedBy' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 1 | ▶ | $res ? $res->{repostedBy} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"repostedBy"} // ()
MC/DC0%0/2
$res->{"repostedBy"} // ()
$res->{"repostedBy"}
()
Truth table33%1/3
A // B
A= $res->{"repostedBy"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 1 | ▶ | method repost( $uri, $cid //= () ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
repost: called CC=4 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 1 | ▶ | if ( !defined $cid ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 1 | my $post = $self->_at_for('app.bsky.feed.getPosts')->get( 'app.bsky.feed.getPosts' => { uris => [$uri] } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 1 | ▶ | $post || $post->throw; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 1 | $cid = $post->{posts}[0]{cid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 1 | $self->at->create_record( 'app.bsky.feed.repost', { subject => { uri => $uri, cid => $cid }, createdAt => $self->at->_now->to_string } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 1 | ▶ | method deleteRepost($url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deleteRepost: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 1 | ▶ | $url = At::Protocol::URI->new($url) unless builtin::blessed $url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 1 | ▶ | if ( $url->collection eq 'app.bsky.feed.post' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 1 | my $post = $self->getPost($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 1 | ▶ | $url = $post->{viewer}{repost} // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$post->{"viewer"}{"repost"} // (return)
MC/DC0%0/1
$post->{"viewer"}{"repost"} // (return)
$post->{"viewer"}{"repost"}
Truth table50%1/2
A
A= $post->{"viewer"}{"repost"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 1 | $self->at->delete_record( 'app.bsky.feed.repost', $url->rkey ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 1 | ▶ | method uploadBlob( $data, %opts ) { $self->at->upload_blob( $data, $opts{mime_type} // () ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uploadBlob: called CC=2 SCAR=9.2
Pod
documented
Condition33%1/3
$opts{"mime_type"} // ()
MC/DC0%0/2
$opts{"mime_type"} // ()
$opts{"mime_type"}
()
Truth table33%1/3
A // B
A= $opts{"mime_type"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 7 | ▶ | method createPost(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createPost: called CC=37 SCAR=41.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # TODO: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | # - recordWithMedia embed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | my %post = ( # these are the required fields which every post must include | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | '$type' => 'app.bsky.feed.post', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | text => $args{text} // '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 7 | ▶ | createdAt => $args{timestamp} // $self->at->_now->to_string # trailing "Z" is preferred over "+00:00" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$args{"text"} // ""
$args{"timestamp"} // $self->at->_now->to_string
MC/DC0%0/1
$args{"text"} // ""
$args{"text"}
MC/DC0%0/2
$args{"timestamp"} // $self->at->_now->to_string
$args{"timestamp"}
$self->at->_now->to_string
Truth table50%1/2
A
A= $args{"text"}
Truth table33%1/3
A // B
A= $args{"timestamp"}B= $self->at->_now->to_string
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | # indicate included languages (optional) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 7 | ▶ | $post{langs} = [ ( ( builtin::reftype( $args{lang} ) // '' ) eq 'ARRAY' ) ? @{ $args{lang} } : $args{lang} ] if defined $args{lang}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%1/2
builtin::reftype($args{"lang"}) // ""
MC/DC0%0/1
builtin::reftype($args{"lang"}) // ""
builtin::reftype($args{"lang"})
Truth table50%1/2
A
A= builtin::reftype($args{"lang"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | # parse out mentions and URLs as "facets" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 7 | ▶ | if ( length $post{text} > 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 7 | my @facets = $self->parse_facets( $post{text} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 7 | ▶ | $post{facets} = \@facets if @facets; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | # additional tags (up to 8) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 7 | ▶ | $post{tags} = [ ( builtin::reftype( $args{tags} ) // '' ) eq 'ARRAY' ? @{ $args{tags} } : $args{tags} ] if defined $args{tags}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%1/2
builtin::reftype($args{"tags"}) // ""
MC/DC0%0/1
builtin::reftype($args{"tags"}) // ""
builtin::reftype($args{"tags"})
Truth table50%1/2
A
A= builtin::reftype($args{"tags"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | # metadata tags on an atproto record, published by the author within the record (up to 10) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | $post{labels} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | '$type' => 'com.atproto.label.defs#selfLabels', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | values => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 1 | ▶ | map { { '$type' => 'com.atproto.label.defs#selfLabel', val => $_ } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
builtin::reftype($args{"labels"}) // ""
MC/DC0%0/1
builtin::reftype($args{"labels"}) // ""
builtin::reftype($args{"labels"})
Truth table50%1/2
A
A= builtin::reftype($args{"labels"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 1 | ( ( builtin::reftype( $args{labels} ) // '' ) eq 'ARRAY' ? @{ $args{labels} } : $args{labels} ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 7 | ▶ | if defined $args{labels}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | #~ com.atproto.label.defs#selfLabels | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # if this is a reply, get references to the parent and root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 7 | ▶ | $post{reply} = $self->getReplyRefs( $args{reply_to} ) if defined $args{reply_to}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | # embeds | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 7 | ▶ | if ( defined $args{embed} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 1 | my $embed = $args{embed}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 1 | ▶ | if ( defined $embed->{'$type'} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | # A fully-built embed (e.g. from videoEmbed()) used as-is. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $post{embed} = $embed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | elsif ( defined $embed->{images} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | $post{embed} = $self->uploadImages( @{ $embed->{images} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | elsif ( defined $embed->{video} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | $post{embed} = $self->uploadVideo( $embed->{video} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | elsif ( defined $embed->{gallery} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | $post{embed} = $self->uploadGallery( @{ $embed->{gallery} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | elsif ( defined $embed->{url} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | $post{embed} = $self->fetch_embed_url_card( $embed->{url} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | elsif ( defined $embed->{ref} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 1 | $post{embed} = $self->getEmbedRef( $embed->{ref} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 7 | my $res = $self->at->create_record( 'app.bsky.feed.post', \%post ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | # If reply_gate is requested, create a threadgate record | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 7 | ▶ | if ( $res && $res->{uri} && $args{reply_gate} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$res and $res->{"uri"} and $args{"reply_gate"}
$res and $res->{"uri"}
MC/DC33%1/3
$res and $res->{"uri"} and $args{"reply_gate"}
$res
$res->{"uri"}
$args{"reply_gate"}
Truth table50%2/4
A and B and C
A= $resB= $res->{"uri"}C= $args{"reply_gate"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 2 | my $post_uri = At::Protocol::URI->new( $res->{uri} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 2 | my @allow; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 2 | ▶ | if ( ref $args{reply_gate} eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 2 | for my $type ( @{ $args{reply_gate} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 6 | ▶ | if ( $type eq 'mention' ) { push @allow, { '$type' => 'app.bsky.feed.threadgate#mentionRule' }; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 1 | elsif ( $type eq 'follower' ) { push @allow, { '$type' => 'app.bsky.feed.threadgate#followerRule' }; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 2 | elsif ( $type eq 'following' ) { push @allow, { '$type' => 'app.bsky.feed.threadgate#followingRule' }; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 1 | elsif ( $type eq 'list' ) { push @allow, { '$type' => 'app.bsky.feed.threadgate#listRule', list => $args{reply_gate_list} }; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 2 | $self->at->create_record( 'app.bsky.feed.threadgate', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | { post => $post_uri->as_string, allow => \@allow, createdAt => $self->at->_now->to_string, }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | $post_uri->rkey ); # Must match post rkey | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # If post_gate is requested, create a postgate record | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 7 | ▶ | if ( $res && $res->{uri} && $args{post_gate} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$res and $res->{"uri"} and $args{"post_gate"}
$res and $res->{"uri"}
MC/DC33%1/3
$res and $res->{"uri"} and $args{"post_gate"}
$res
$res->{"uri"}
$args{"post_gate"}
Truth table50%2/4
A and B and C
A= $resB= $res->{"uri"}C= $args{"post_gate"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 2 | my $post_uri = At::Protocol::URI->new( $res->{uri} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 2 | my @embedding_rules; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 2 | ▶ | if ( ref $args{post_gate} eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 2 | for my $rule ( @{ $args{post_gate} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 2 | ▶ | if ( $rule eq 'disable' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 2 | push @embedding_rules, { '$type' => 'app.bsky.feed.postgate#disableRule' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 2 | $self->at->create_record( 'app.bsky.feed.postgate', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | { post => $post_uri->as_string, embeddingRules => \@embedding_rules, createdAt => $self->at->_now->to_string, }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | $post_uri->rkey ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 7 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 1 | ▶ | method deletePost($at_uri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deletePost: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 1 | ▶ | $at_uri = At::Protocol::URI->new($at_uri) unless builtin::blessed $at_uri; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 1 | $self->at->delete_record( 'app.bsky.feed.post', $at_uri->rkey ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | # Automatically try to delete gates too | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 1 | $self->at->delete_record( 'app.bsky.feed.threadgate', $at_uri->rkey ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 1 | $self->at->delete_record( 'app.bsky.feed.postgate', $at_uri->rkey ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 1 | ▶ | method like( $uri, $cid //= () ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
like: called CC=4 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 1 | ▶ | if ( !defined $cid ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 1 | my $post = $self->_at_for('app.bsky.feed.getPosts')->get( 'app.bsky.feed.getPosts' => { uris => [$uri] } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 1 | ▶ | $post || $post->throw; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 1 | $cid = $post->{posts}[0]{cid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | $self->at->create_record( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 1 | 'app.bsky.feed.like', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | { '$type' => 'app.bsky.feed.like', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | subject => { # com.atproto.repo.strongRef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | uri => $uri, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | cid => $cid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | createdAt => $self->at->_now->to_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 1 | ▶ | method deleteLike($url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deleteLike: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 1 | ▶ | $url = At::Protocol::URI->new($url) unless builtin::blessed $url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 1 | ▶ | if ( $url->collection eq 'app.bsky.feed.post' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 1 | my $post = $self->getPost($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 1 | ▶ | $url = $post->{viewer}{like} // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$post->{"viewer"}{"like"} // (return)
MC/DC0%0/1
$post->{"viewer"}{"like"} // (return)
$post->{"viewer"}{"like"}
Truth table50%1/2
A
A= $post->{"viewer"}{"like"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 1 | $self->at->delete_record( 'app.bsky.feed.like', $url->rkey ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | # Social graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 1 | ▶ | method block($actor) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
block: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 1 | my $profile = $self->getProfile($actor); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 1 | ▶ | $profile->{did} // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$profile->{"did"} // (return)
MC/DC0%0/1
$profile->{"did"} // (return)
$profile->{"did"}
Truth table50%1/2
A
A= $profile->{"did"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 1 | $self->at->create_record( 'app.bsky.graph.block', { createdAt => $self->at->_now->to_string, subject => $profile->{did} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 1 | ▶ | method getBlocks(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getBlocks: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 1 | my $res = $self->_at_for('app.bsky.graph.getBlocks')->get( 'app.bsky.graph.getBlocks' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 1 | ▶ | $res ? $res->{blocks} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 1 | ▶ | method deleteBlock($url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deleteBlock: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 1 | ▶ | $url = At::Protocol::URI->new($url) unless builtin::blessed $url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 1 | $self->at->delete_record( 'app.bsky.graph.block', $url->rkey ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 1 | ▶ | method follow($subject) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
follow: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 1 | my $profile = $self->getProfile($subject); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 1 | ▶ | $profile->{did} // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$profile->{"did"} // (return)
MC/DC0%0/1
$profile->{"did"} // (return)
$profile->{"did"}
Truth table50%1/2
A
A= $profile->{"did"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | $self->at->create_record( 'app.bsky.graph.follow', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 1 | { '$type' => 'app.bsky.graph.follow', subject => $profile->{did}, createdAt => $self->at->_now->to_string } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 1 | ▶ | method deleteFollow($url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deleteFollow: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 1 | ▶ | $url = At::Protocol::URI->new($url) unless builtin::blessed $url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 1 | $self->at->delete_record( 'app.bsky.graph.follow', $url->rkey ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 1 | ▶ | method getFollows( $actor, %args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getFollows: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 1 | my $res = $self->_at_for('app.bsky.graph.getFollows')->get( 'app.bsky.graph.getFollows' => { actor => $actor, %args } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 1 | ▶ | $res ? $res->{follows} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 1 | ▶ | method getFollowers( $actor, %args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getFollowers: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 1 | my $res = $self->_at_for('app.bsky.graph.getFollowers')->get( 'app.bsky.graph.getFollowers' => { actor => $actor, %args } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 1 | ▶ | $res ? $res->{followers} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 1 | ▶ | method getKnownFollowers( $actor, %args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getKnownFollowers: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 1 | my $res = $self->_at_for('app.bsky.graph.getKnownFollowers')->get( 'app.bsky.graph.getKnownFollowers' => { actor => $actor, %args } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 1 | ▶ | $res ? $res->{followers} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 1 | ▶ | method getRelationships(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getRelationships: called CC=5 SCAR=18.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 1 | ▶ | $args{actor} //= $self->at->did; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args{"actor"} //= $self->at->did
MC/DC0%0/2
$args{"actor"} //= $self->at->did
$args{"actor"}
$self->at->did
Truth table33%1/3
A //= B
A= $args{"actor"}B= $self->at->did
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 1 | ▶ | if ( exists $args{actors} && !exists $args{others} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $args{"actors"} and not exists $args{"others"}
MC/DC0%0/2
exists $args{"actors"} and not exists $args{"others"}
exists $args{"actors"}
not exists $args{"others"}
Truth table33%1/3
A and not(B)
A= exists $args{"actors"}B= not exists $args{"others"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 1 | $args{others} = delete $args{actors}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 1 | my $res = $self->_at_for('app.bsky.graph.getRelationships')->get( 'app.bsky.graph.getRelationships' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 1 | ▶ | $res ? $res->{relationships} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 1 | ▶ | method getMutes(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getMutes: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 1 | my $res = $self->_at_for('app.bsky.graph.getMutes')->get( 'app.bsky.graph.getMutes' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 1 | ▶ | $res ? $res->{mutes} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"mutes"} // ()
MC/DC0%0/2
$res->{"mutes"} // ()
$res->{"mutes"}
()
Truth table33%1/3
A // B
A= $res->{"mutes"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 1 | ▶ | method muteThread($uri) { $self->_at_for('app.bsky.graph.muteThread')->post( 'app.bsky.graph.muteThread' => { root => $uri } ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
muteThread: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 1 | ▶ | method unmuteThread($uri) { $self->_at_for('app.bsky.graph.unmuteThread')->post( 'app.bsky.graph.unmuteThread' => { root => $uri } ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unmuteThread: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 1 | ▶ | method getListBlocks(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getListBlocks: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 1 | my $res = $self->_at_for('app.bsky.graph.getListBlocks')->get( 'app.bsky.graph.getListBlocks' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 1 | ▶ | $res ? $res->{lists} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"lists"} // ()
MC/DC0%0/2
$res->{"lists"} // ()
$res->{"lists"}
()
Truth table33%1/3
A // B
A= $res->{"lists"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 1 | ▶ | method getListMutes(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getListMutes: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 1 | my $res = $self->_at_for('app.bsky.graph.getListMutes')->get( 'app.bsky.graph.getListMutes' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 1 | ▶ | $res ? $res->{lists} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"lists"} // ()
MC/DC0%0/2
$res->{"lists"} // ()
$res->{"lists"}
()
Truth table33%1/3
A // B
A= $res->{"lists"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 1 | ▶ | method getLists( $actor, %args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getLists: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 1 | my $res = $self->_at_for('app.bsky.graph.getLists')->get( 'app.bsky.graph.getLists' => { actor => $actor, %args } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 1 | ▶ | $res ? $res->{lists} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"lists"} // ()
MC/DC0%0/2
$res->{"lists"} // ()
$res->{"lists"}
()
Truth table33%1/3
A // B
A= $res->{"lists"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 1 | ▶ | method getListsWithMembership( $actor, %args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getListsWithMembership: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 1 | my $res | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | = $self->_at_for('app.bsky.graph.getListsWithMembership')->get( 'app.bsky.graph.getListsWithMembership' => { actor => $actor, %args } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 1 | ▶ | $res ? $res->{listsWithMembership} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"listsWithMembership"} // ()
MC/DC0%0/2
$res->{"listsWithMembership"} // ()
$res->{"listsWithMembership"}
()
Truth table33%1/3
A // B
A= $res->{"listsWithMembership"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 1 | ▶ | method getList( $list, %args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getList: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 1 | my $res = $self->_at_for('app.bsky.graph.getList')->get( 'app.bsky.graph.getList' => { list => $list, %args } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | ▶ | $res ? $res->{items} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"items"} // ()
MC/DC0%0/2
$res->{"items"} // ()
$res->{"items"}
()
Truth table33%1/3
A // B
A= $res->{"items"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 1 | ▶ | method getStarterPack($uri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getStarterPack: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 1 | $self->_at_for('app.bsky.graph.getStarterPack')->get( 'app.bsky.graph.getStarterPack' => { starterPack => $uri } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 1 | ▶ | method getStarterPacks(@uris) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getStarterPacks: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 1 | my $res = $self->_at_for('app.bsky.graph.getStarterPacks')->get( 'app.bsky.graph.getStarterPacks' => { uris => \@uris } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 1 | ▶ | $res ? $res->{starterPacks} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"starterPacks"} // ()
MC/DC0%0/2
$res->{"starterPacks"} // ()
$res->{"starterPacks"}
()
Truth table33%1/3
A // B
A= $res->{"starterPacks"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 1 | ▶ | method getActorStarterPacks( $actor, %args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getActorStarterPacks: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 1 | my $res = $self->_at_for('app.bsky.graph.getActorStarterPacks')->get( 'app.bsky.graph.getActorStarterPacks' => { actor => $actor, %args } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 1 | ▶ | $res ? $res->{starterPacks} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"starterPacks"} // ()
MC/DC0%0/2
$res->{"starterPacks"} // ()
$res->{"starterPacks"}
()
Truth table33%1/3
A // B
A= $res->{"starterPacks"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 1 | ▶ | method getStarterPacksWithMembership( $actor, %args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getStarterPacksWithMembership: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 1 | my $res = $self->_at_for('app.bsky.graph.getStarterPacksWithMembership') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | ->get( 'app.bsky.graph.getStarterPacksWithMembership' => { actor => $actor, %args } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 1 | ▶ | $res ? $res->{starterPacksWithMembership} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"starterPacksWithMembership"} // ()
MC/DC0%0/2
$res->{"starterPacksWithMembership"} // ()
$res->{"starterPacksWithMembership"}
()
Truth table33%1/3
A // B
A= $res->{"starterPacksWithMembership"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 1 | ▶ | method getSuggestedFollowsByActor($actor) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getSuggestedFollowsByActor: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 1 | my $res | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | = $self->_at_for('app.bsky.graph.getSuggestedFollowsByActor')->get( 'app.bsky.graph.getSuggestedFollowsByActor' => { actor => $actor } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 1 | ▶ | $res ? $res->{suggestions} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"suggestions"} // ()
MC/DC0%0/2
$res->{"suggestions"} // ()
$res->{"suggestions"}
()
Truth table33%1/3
A // B
A= $res->{"suggestions"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 1 | ▶ | method searchStarterPacks(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
searchStarterPacks: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 1 | my $res = $self->_at_for('app.bsky.graph.searchStarterPacks')->get( 'app.bsky.graph.searchStarterPacks' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 1 | ▶ | $res ? $res->{starterPacks} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"starterPacks"} // ()
MC/DC0%0/2
$res->{"starterPacks"} // ()
$res->{"starterPacks"}
()
Truth table33%1/3
A // B
A= $res->{"starterPacks"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | # Actors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 3 | ▶ | method getProfile($actor) { $self->_at_for('app.bsky.actor.getProfile')->get( 'app.bsky.actor.getProfile' => { actor => $actor } ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getProfile: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 1 | ▶ | method getPreferences() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPreferences: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 1 | my $res = $self->_at_for('app.bsky.actor.getPreferences')->get('app.bsky.actor.getPreferences'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 1 | ▶ | $res ? $res->{preferences} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 1 | ▶ | method putPreferences($preferences) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
putPreferences: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 1 | $self->_at_for('app.bsky.actor.putPreferences')->post( 'app.bsky.actor.putPreferences' => { preferences => $preferences } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 1 | ▶ | method upsertProfile($cb) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
upsertProfile: called CC=4 SCAR=14.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 1 | my $profile = $self->_at_for('com.atproto.repo.getRecord') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | ->get( 'com.atproto.repo.getRecord' => { repo => $self->at->did, collection => 'app.bsky.actor.profile', rkey => 'self' } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 1 | ▶ | my %existing = $profile ? %{ $profile->{value} } : ( '$type' => 'app.bsky.actor.profile' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 1 | my $updated = $cb->(%existing); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 1 | ▶ | my $res = $self->at->put_record( 'app.bsky.actor.profile', 'self', $updated, $profile ? $profile->{cid} : () ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 1 | ▶ | $res // 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$res // 1
MC/DC0%0/1
$res // 1
$res
Truth table50%1/2
A
A= $res
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 1 | ▶ | method getProfiles(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getProfiles: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 1 | my $res = $self->_at_for('app.bsky.actor.getProfiles')->get( 'app.bsky.actor.getProfiles' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 1 | ▶ | return $res ? ( $res->{profiles} // [] ) : []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$res->{"profiles"} // []
MC/DC0%0/1
$res->{"profiles"} // []
$res->{"profiles"}
Truth table50%1/2
A
A= $res->{"profiles"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 1 | ▶ | method getSuggestions(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getSuggestions: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 1 | my $res = $self->_at_for('app.bsky.actor.getSuggestions')->get( 'app.bsky.actor.getSuggestions' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 1 | ▶ | $res ? $res->{actors} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 1 | ▶ | method searchActors(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
searchActors: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 1 | my $res = $self->_at_for('app.bsky.actor.searchActors')->get( 'app.bsky.actor.searchActors' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 1 | ▶ | $res ? $res->{actors} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 1 | ▶ | method searchActorsTypeahead(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
searchActorsTypeahead: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 1 | my $res = $self->_at_for('app.bsky.actor.searchActorsTypeahead')->get( 'app.bsky.actor.searchActorsTypeahead' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 1 | ▶ | $res ? $res->{actors} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 1 | ▶ | method mute($actor) { $self->_at_for('app.bsky.graph.muteActor')->post( 'app.bsky.graph.muteActor' => { actor => $actor } ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mute: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 1 | ▶ | method unmute($actor) { $self->_at_for('app.bsky.graph.unmuteActor')->post( 'app.bsky.graph.unmuteActor' => { actor => $actor } ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unmute: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 1 | ▶ | method muteModList($listUri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
muteModList: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 1 | $self->_at_for('app.bsky.graph.muteActorList')->post( 'app.bsky.graph.muteActorList' => { list => $listUri } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 1 | ▶ | method unmuteModList($listUri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unmuteModList: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 1 | $self->_at_for('app.bsky.graph.unmuteActorList')->post( 'app.bsky.graph.unmuteActorList' => { list => $listUri } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 1 | ▶ | method blockModList($listUri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
blockModList: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 1 | $self->at->create_record( 'app.bsky.graph.listblock', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | { '$type' => 'app.bsky.graph.listblock', subject => $listUri, createdAt => $self->at->_now->to_string } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | # Moderation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 1 | ▶ | method report ( $subject, $reason_type, $reason = () ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
report: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 1 | ▶ | $self->_at_for('com.atproto.moderation.createReport') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | ->post( 'com.atproto.moderation.createReport' => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | { subject => $subject, reasonType => $reason_type, defined $reason ? ( reason => $reason ) : () } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 1 | ▶ | method unblockModList($url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unblockModList: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 1 | ▶ | $url = At::Protocol::URI->new($url) unless builtin::blessed $url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 1 | $self->at->delete_record( 'app.bsky.graph.listblock', $url->rkey ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | # Notifications | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 1 | ▶ | method listNotifications(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
listNotifications: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 1 | my $res = $self->at->get( 'app.bsky.notification.listNotifications' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 1 | ▶ | $res ? $res->{notifications} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 1 | ▶ | method countUnreadNotifications() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
countUnreadNotifications: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 1 | my $res = $self->at->get('app.bsky.notification.getUnreadCount'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 1 | ▶ | $res ? $res->{count} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 1 | ▶ | method updateSeenNotifications( $seenAt = undef ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
updateSeenNotifications: called CC=4 SCAR=15.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 1 | ▶ | my $res = $self->at->post( 'app.bsky.notification.updateSeen' => { seenAt => $seenAt // $self->at->_now->to_string } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$seenAt // $self->at->_now->to_string
MC/DC0%0/2
$seenAt // $self->at->_now->to_string
$seenAt
$self->at->_now->to_string
Truth table33%1/3
A // B
A= $seenAtB= $self->at->_now->to_string
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 1 | ▶ | $res // 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$res // 1
MC/DC0%0/1
$res // 1
$res
Truth table50%1/2
A
A= $res
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 1 | ▶ | method getNotificationPreferences() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getNotificationPreferences: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 1 | my $res = $self->_at_for('app.bsky.notification.getPreferences')->get('app.bsky.notification.getPreferences'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 1 | ▶ | $res ? $res->{preferences} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"preferences"} // ()
MC/DC0%0/2
$res->{"preferences"} // ()
$res->{"preferences"}
()
Truth table33%1/3
A // B
A= $res->{"preferences"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 1 | ▶ | method putNotificationPreferences(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
putNotificationPreferences: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 1 | $self->_at_for('app.bsky.notification.putPreferences')->post( 'app.bsky.notification.putPreferences' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 1 | ▶ | method putNotificationPreferencesV2(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
putNotificationPreferencesV2: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 1 | my $res = $self->_at_for('app.bsky.notification.putPreferencesV2')->post( 'app.bsky.notification.putPreferencesV2' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 1 | ▶ | $res ? $res->{preferences} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"preferences"} // ()
MC/DC0%0/2
$res->{"preferences"} // ()
$res->{"preferences"}
()
Truth table33%1/3
A // B
A= $res->{"preferences"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 1 | ▶ | method listActivitySubscriptions(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
listActivitySubscriptions: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 1 | my $res | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | = $self->_at_for('app.bsky.notification.listActivitySubscriptions')->get( 'app.bsky.notification.listActivitySubscriptions' => \%args ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 1 | ▶ | $res ? $res->{subscriptions} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"subscriptions"} // ()
MC/DC0%0/2
$res->{"subscriptions"} // ()
$res->{"subscriptions"}
()
Truth table33%1/3
A // B
A= $res->{"subscriptions"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 1 | ▶ | method putActivitySubscription( $subject, $activitySubscription ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
putActivitySubscription: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 1 | $self->_at_for('app.bsky.notification.putActivitySubscription') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | ->post( 'app.bsky.notification.putActivitySubscription' => { subject => $subject, activitySubscription => $activitySubscription } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 1 | ▶ | method registerPush(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
registerPush: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 1 | $self->_at_for('app.bsky.notification.registerPush')->post( 'app.bsky.notification.registerPush' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 1 | ▶ | method unregisterPush(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unregisterPush: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 1 | $self->_at_for('app.bsky.notification.unregisterPush')->post( 'app.bsky.notification.unregisterPush' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | # Identity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 1 | ▶ | method resolveHandle($handle) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolveHandle: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 1 | my $res = $self->at->get( 'com.atproto.identity.resolveHandle' => { handle => $handle } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 1 | ▶ | $res ? $res->{did} : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 1 | ▶ | method updateHandle($handle) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
updateHandle: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 1 | $self->at->post( 'com.atproto.identity.updateHandle' => { handle => $handle } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 1 | ▶ | method describeServer() { $self->at->get('com.atproto.server.describeServer') } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
describeServer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 1 | ▶ | method listRecords(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
listRecords: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 1 | my $res = $self->at->get( 'com.atproto.repo.listRecords' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 1 | ▶ | $res ? $res->{records} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"records"} // ()
MC/DC0%0/2
$res->{"records"} // ()
$res->{"records"}
()
Truth table33%1/3
A // B
A= $res->{"records"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 1 | ▶ | method getLabelerServices(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getLabelerServices: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 1 | my $res = $self->at->get( 'app.bsky.labeler.getServices' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 1 | ▶ | $res ? $res->{views} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"views"} // ()
MC/DC0%0/2
$res->{"views"} // ()
$res->{"views"}
()
Truth table33%1/3
A // B
A= $res->{"views"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 1 | ▶ | method queryLabels(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
queryLabels: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 1 | my $res = $self->_at_for('com.atproto.label.queryLabels')->get( 'com.atproto.label.queryLabels' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 1 | ▶ | $res ? $res->{labels} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"labels"} // ()
MC/DC0%0/2
$res->{"labels"} // ()
$res->{"labels"}
()
Truth table33%1/3
A // B
A= $res->{"labels"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | # Chat | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 2 | ▶ | method listConvos(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
listConvos: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 2 | my $res = $self->_at_for('chat.bsky.convo.listConvos')->get( 'chat.bsky.convo.listConvos' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 2 | ▶ | $res ? $res->{convos} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"convos"} // ()
MC/DC0%0/2
$res->{"convos"} // ()
$res->{"convos"}
()
Truth table33%1/3
A // B
A= $res->{"convos"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 1 | ▶ | method getConvo($convoId) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getConvo: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 1 | my $res = $self->_at_for('chat.bsky.convo.getConvo')->get( 'chat.bsky.convo.getConvo' => { convoId => $convoId } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 1 | ▶ | $res ? $res->{convo} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"convo"} // ()
MC/DC0%0/2
$res->{"convo"} // ()
$res->{"convo"}
()
Truth table33%1/3
A // B
A= $res->{"convo"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 1 | ▶ | method getConvoForMembers(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getConvoForMembers: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 1 | my $res = $self->_at_for('chat.bsky.convo.getConvoForMembers')->get( 'chat.bsky.convo.getConvoForMembers' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 1 | ▶ | $res ? $res->{convo} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"convo"} // ()
MC/DC0%0/2
$res->{"convo"} // ()
$res->{"convo"}
()
Truth table33%1/3
A // B
A= $res->{"convo"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 2 | ▶ | method getMessages(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getMessages: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 2 | my $res = $self->_at_for('chat.bsky.convo.getMessages')->get( 'chat.bsky.convo.getMessages' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 2 | ▶ | $res ? $res->{messages} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"messages"} // ()
MC/DC0%0/2
$res->{"messages"} // ()
$res->{"messages"}
()
Truth table33%1/3
A // B
A= $res->{"messages"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 2 | ▶ | method sendMessage( $convoId, $message ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sendMessage: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 2 | $self->_at_for('chat.bsky.convo.sendMessage')->post( 'chat.bsky.convo.sendMessage' => { convoId => $convoId, message => $message } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 1 | ▶ | method acceptConvo($convoId) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
acceptConvo: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 1 | $self->_at_for('chat.bsky.convo.acceptConvo')->post( 'chat.bsky.convo.acceptConvo' => { convoId => $convoId } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 1 | ▶ | method leaveConvo($convoId) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
leaveConvo: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 1 | $self->_at_for('chat.bsky.convo.leaveConvo')->post( 'chat.bsky.convo.leaveConvo' => { convoId => $convoId } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 1 | ▶ | method updateRead( $convoId, $messageId = undef ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
updateRead: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 1 | $self->_at_for('chat.bsky.convo.updateRead')->post( 'chat.bsky.convo.updateRead' => { convoId => $convoId, messageId => $messageId } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 2 | ▶ | method muteConvo($convoId) { $self->_at_for('chat.bsky.convo.muteConvo')->post( 'chat.bsky.convo.muteConvo' => { convoId => $convoId } ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
muteConvo: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 2 | ▶ | method unmuteConvo($convoId) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unmuteConvo: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 2 | $self->_at_for('chat.bsky.convo.unmuteConvo')->post( 'chat.bsky.convo.unmuteConvo' => { convoId => $convoId } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 1 | ▶ | method addReaction( $convoId, $messageId, $reaction ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
addReaction: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 1 | $self->_at_for('chat.bsky.convo.addReaction') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | ->post( 'chat.bsky.convo.addReaction' => { convoId => $convoId, messageId => $messageId, reaction => $reaction } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 1 | ▶ | method removeReaction( $convoId, $messageId, $reaction ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
removeReaction: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 1 | $self->_at_for('chat.bsky.convo.removeReaction') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | ->post( 'chat.bsky.convo.removeReaction' => { convoId => $convoId, messageId => $messageId, reaction => $reaction } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 1 | ▶ | method deleteMessageForSelf( $convoId, $messageId ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deleteMessageForSelf: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 1 | $self->_at_for('chat.bsky.convo.deleteMessageForSelf') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | ->post( 'chat.bsky.convo.deleteMessageForSelf' => { convoId => $convoId, messageId => $messageId } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 1 | ▶ | method getConvoAvailability(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getConvoAvailability: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 1 | $self->_at_for('chat.bsky.convo.getConvoAvailability')->get( 'chat.bsky.convo.getConvoAvailability' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 1 | ▶ | method getLog(%args) { $self->_at_for('chat.bsky.convo.getLog')->get( 'chat.bsky.convo.getLog' => \%args ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getLog: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | # Video services (https://atproto.com/guides/video-handling) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | # Video processing lives on a sidecar service (video.bsky.app), not on the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | # PDS. Each call is authenticated with a short-lived service token minted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | # by the user's PDS via com.atproto.server.getServiceAuth, then sent as a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | # plain "Bearer" token. The session's DPoP token is NOT used here, which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | # is why posting video to the PDS returns 501 Method Not Implemented. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 2 | ▶ | method _video_http() { state $http //= HTTP::Tiny->new; $http } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_video_http: called CC=2 SCAR=7.1
Condition66%2/3
state $http //= "HTTP::Tiny"->new
MC/DC0%0/2
state $http //= "HTTP::Tiny"->new
state $http
"HTTP::Tiny"->new
Truth table66%2/3
A //= B
A= state $httpB= "HTTP::Tiny"->new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | # did:web form of the user's PDS. Used as the audience for the token that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | # lets the video service deposit the processed blob in our PDS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | ▶ | method _pds_did() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pds_did: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | my $session = eval { $self->at->session }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | ▶ | my $pds = ( builtin::blessed $session && $session->can('pds') ? $session->pds : undef ) // $self->at->host; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
(builtin::blessed($session) && $session->can("pds") ? $session->pds : undef) // $self->at->host
builtin::blessed($session) and $session->can("pds")
MC/DC0%0/3
(builtin::blessed($session) && $session->can("pds") ? $session->pds : undef) // $self->at->host
builtin::blessed($session)
$session->can("pds")
$self->at->host
Truth table0%0/5
A and B // C
A= builtin::blessed($session)B= $session->can("pds")C= $self->at->host
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | $pds = $pds . ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | $pds =~ s{^https?://}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | $pds =~ s{/.*$}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | $pds =~ s{:}{%3A}g; # did:web encodes the port separator | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | 'did:web:' . $pds; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | # Mint a service token for the given audience/lexicon. Returns the token | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | # string, or an At::Error which callers should propagate. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 2 | ▶ | method _service_token ( $aud, $lxm, $exp = undef ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_service_token: called CC=6 SCAR=21.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 2 | ▶ | my $res = $self->at->get( 'com.atproto.server.getServiceAuth' => { aud => $aud, lxm => $lxm, exp => ( $exp // ( time + 1800 ) ) } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$exp // time + 1800
MC/DC0%0/1
$exp // time + 1800
$exp
Truth table50%1/2
A
A= $exp
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 2 | ▶ | return $res if builtin::blessed $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 2 | ▶ | return $res->{token} if ref $res eq 'HASH' && defined $res->{token}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $res eq "HASH" and defined $res->{"token"}
MC/DC0%0/2
ref $res eq "HASH" and defined $res->{"token"}
ref $res eq "HASH"
defined $res->{"token"}
Truth table33%1/3
A and B
A= ref $res eq "HASH"B= defined $res->{"token"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | At::Error->new( message => 'getServiceAuth did not return a token', fatal => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 2 | ▶ | method _video_url ( $lexicon, %query ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_video_url: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 2 | my $url = "$video_service/xrpc/$lexicon"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 2 | my @pairs = map { "$_=" . URI::Escape::uri_escape( $query{$_} ) } grep { defined $query{$_} } sort keys %query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 2 | ▶ | @pairs ? "$url?" . join( '&', @pairs ) : $url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | ▶ | method _video_error ( $res, $content ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_video_error: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | ▶ | my $msg = $res->{reason} // 'Unknown error'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$res->{"reason"} // "Unknown error"
MC/DC0%0/1
$res->{"reason"} // "Unknown error"
$res->{"reason"}
Truth table0%0/2
A
A= $res->{"reason"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | ▶ | if ( ref $content eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | ▶ | my $detail = $content->{message} // $content->{error}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$content->{"message"} // $content->{"error"}
MC/DC0%0/2
$content->{"message"} // $content->{"error"}
$content->{"message"}
$content->{"error"}
Truth table0%0/3
A // B
A= $content->{"message"}B= $content->{"error"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | ▶ | $msg = $detail . ' (' . $msg . ')' if defined $detail && $detail ne $msg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $detail and $detail ne $msg
MC/DC0%0/2
defined $detail and $detail ne $msg
defined $detail
$detail ne $msg
Truth table0%0/3
A and B
A= defined $detailB= $detail ne $msg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | At::Error->new( message => $msg, fatal => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | # The video service wraps job data in a "jobStatus" key; unwrap it when | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | # present, otherwise return the payload untouched. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 2 | ▶ | method _unwrap_job ($content) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unwrap_job: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 2 | ▶ | return $content unless ref $content eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 2 | ▶ | $content->{jobStatus} // $content; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$content->{"jobStatus"} // $content
MC/DC0%0/2
$content->{"jobStatus"} // $content
$content->{"jobStatus"}
$content
Truth table66%2/3
A // B
A= $content->{"jobStatus"}B= $content
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 1 | ▶ | method getVideoUploadLimits () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getVideoUploadLimits: called CC=7 SCAR=23.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 1 | my $token = $self->_service_token( 'did:web:video.bsky.app', 'app.bsky.video.getUploadLimits' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 1 | ▶ | return $token if builtin::blessed $token; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 1 | my $res = $self->_video_http->get( $self->_video_url('app.bsky.video.getUploadLimits'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | { headers => { Authorization => "Bearer $token", Accept => 'application/json' } } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 1 | my $content = $res->{content}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 1 | ▶ | $content = decode_json($content) if defined $content && !ref $content && ( $res->{headers}{'content-type'} // '' ) =~ m[json]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition37%3/8
defined $content and not ref $content and ($res->{"headers"}{"content-type"} // "") =~ /json/d
defined $content and not ref $content
$res->{"headers"}{"content-type"} // ""
MC/DC0%0/3
defined $content and not ref $content and ($res->{"headers"}{"content-type"} // "") =~ /json/d
defined $content
not ref $content
$res->{"headers"}{"content-type"}
Truth table25%1/4
A and not(B) and C
A= defined $contentB= not ref $contentC= $res->{"headers"}{"content-type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 1 | ▶ | $res->{success} ? $self->_unwrap_job($content) : $self->_video_error( $res, $content ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 1 | ▶ | method getVideoJobStatus ( $jobId, %opts ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getVideoJobStatus: called CC=8 SCAR=25.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 1 | ▶ | my $token = $opts{token} // $self->_service_token( 'did:web:video.bsky.app', 'app.bsky.video.getJobStatus', $opts{exp} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts{"token"} // $self->_service_token("did:web:video.bsky.app", "app.bsky.video.getJobStatus", $opts{"exp"})
MC/DC0%0/2
$opts{"token"} // $self->_service_token("did:web:video.bsky.app", "app.bsky.video.getJobStatus", $opts{"exp"})
$opts{"token"}
$self->_service_token("did:web:video.bsky.app", "app.bsky.video.getJobStatus", $opts{"exp"})
Truth table33%1/3
A // B
A= $opts{"token"}B= $self->_service_token("did:web:video.bsky.app", "app.bsky.video.getJobStatus", $opts{"exp"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 1 | ▶ | return $token if builtin::blessed $token; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 1 | my $res = $self->_video_http->get( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | $self->_video_url( 'app.bsky.video.getJobStatus', jobId => $jobId ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | { headers => { Authorization => "Bearer $token", Accept => 'application/json' } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 1 | my $content = $res->{content}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 1 | ▶ | $content = decode_json($content) if defined $content && !ref $content && ( $res->{headers}{'content-type'} // '' ) =~ m[json]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition37%3/8
defined $content and not ref $content and ($res->{"headers"}{"content-type"} // "") =~ /json/d
defined $content and not ref $content
$res->{"headers"}{"content-type"} // ""
MC/DC0%0/3
defined $content and not ref $content and ($res->{"headers"}{"content-type"} // "") =~ /json/d
defined $content
not ref $content
$res->{"headers"}{"content-type"}
Truth table25%1/4
A and not(B) and C
A= defined $contentB= not ref $contentC= $res->{"headers"}{"content-type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 1 | ▶ | return $self->_video_error( $res, $content ) unless $res->{success}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 1 | $self->_unwrap_job($content); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | ▶ | method uploadVideoJob ( $bytes, $mime_type = 'video/mp4', %opts ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uploadVideoJob: not called CC=18 SCAR=58.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | ▶ | if ( builtin::blessed $bytes ) { $bytes = $bytes->slurp_raw } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | ▶ | elsif ( !ref $bytes && $bytes !~ /[\x00-\x1f]/ && -e $bytes ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
not ref $bytes || $bytes =~ /[\x00-\x1f]/d and -e $bytes
ref $bytes || $bytes =~ /[\x00-\x1f]/d
MC/DC0%0/3
not ref $bytes || $bytes =~ /[\x00-\x1f]/d and -e $bytes
ref $bytes
$bytes =~ /[\x00-\x1f]/d
-e $bytes
Truth table0%0/4
not(A || B) and C
A= ref $bytesB= $bytes =~ /[\x00-\x1f]/dC= -e $bytes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | $bytes = path($bytes)->slurp_raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | ▶ | $opts{did} //= $self->did; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$opts{"did"} //= $self->did
MC/DC0%0/2
$opts{"did"} //= $self->did
$opts{"did"}
$self->did
Truth table0%0/3
A //= B
A= $opts{"did"}B= $self->did
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | ▶ | my $base = $opts{host} // $video_service; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$opts{"host"} // $video_service
MC/DC0%0/2
$opts{"host"} // $video_service
$opts{"host"}
$video_service
Truth table0%0/3
A // B
A= $opts{"host"}B= $video_service
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | my $query = join( '&', map { "$_=" . URI::Escape::uri_escape( $opts{$_} ) } grep { defined $opts{$_} } qw[did name] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | ▶ | my $url = "$base/xrpc/app.bsky.video.uploadVideo" . ( $query ? "?$query" : '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | # uploadVideo writes into the PDS on our behalf, so the token audience | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | # is the PDS and the lexicon is uploadBlob, not uploadVideo. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | ▶ | my $token = $opts{token} // $self->_service_token( $opts{aud} // $self->_pds_did, 'com.atproto.repo.uploadBlob', $opts{exp} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$opts{"token"} // $self->_service_token($opts{"aud"} // $self->_pds_did, "com.atproto.repo.uploadBlob", $opts{"exp"})
$opts{"aud"} // $self->_pds_did
MC/DC0%0/2
$opts{"token"} // $self->_service_token($opts{"aud"} // $self->_pds_did, "com.atproto.repo.uploadBlob", $opts{"exp"})
$opts{"token"}
$self->_service_token($opts{"aud"} // $self->_pds_did, "com.atproto.repo.uploadBlob", $opts{"exp"})
MC/DC0%0/2
$opts{"aud"} // $self->_pds_did
$opts{"aud"}
$self->_pds_did
Truth table0%0/3
A // B
A= $opts{"token"}B= $self->_service_token($opts{"aud"} // $self->_pds_did, "com.atproto.repo.uploadBlob", $opts{"exp"})
Truth table0%0/3
A // B
A= $opts{"aud"}B= $self->_pds_did
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | ▶ | return $token if builtin::blessed $token; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | my $res | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | = $self->_video_http->post( $url, { content => $bytes, headers => { Authorization => "Bearer $token", 'Content-Type' => $mime_type } } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | my $content = $res->{content}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | ▶ | $content = decode_json($content) if defined $content && !ref $content && ( $res->{headers}{'content-type'} // '' ) =~ m[json]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/8
defined $content and not ref $content and ($res->{"headers"}{"content-type"} // "") =~ /json/d
defined $content and not ref $content
$res->{"headers"}{"content-type"} // ""
MC/DC0%0/3
defined $content and not ref $content and ($res->{"headers"}{"content-type"} // "") =~ /json/d
defined $content
not ref $content
$res->{"headers"}{"content-type"}
Truth table0%0/4
A and not(B) and C
A= defined $contentB= not ref $contentC= $res->{"headers"}{"content-type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | # 409 Conflict means the video was already processed; the body still | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | # carries a usable jobStatus (including the finished blob). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | ▶ | return $self->_video_error( $res, $content ) unless $res->{success} || $res->{status} == 409; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$res->{"success"} or $res->{"status"} == 409
MC/DC0%0/2
$res->{"success"} or $res->{"status"} == 409
$res->{"success"}
$res->{"status"} == 409
Truth table0%0/3
A or B
A= $res->{"success"}B= $res->{"status"} == 409
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | $self->_unwrap_job($content); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | # Drafts (private post drafts via stash) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 1 | ▶ | method getDrafts(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getDrafts: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 1 | my $res = $self->_at_for('app.bsky.draft.getDrafts')->get( 'app.bsky.draft.getDrafts' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 1 | ▶ | $res ? $res->{drafts} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"drafts"} // ()
MC/DC0%0/2
$res->{"drafts"} // ()
$res->{"drafts"}
()
Truth table33%1/3
A // B
A= $res->{"drafts"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 1 | ▶ | method createDraft($draft) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createDraft: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 1 | $self->_at_for('app.bsky.draft.createDraft')->post( 'app.bsky.draft.createDraft' => { draft => $draft } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 1 | ▶ | method updateDraft($draft) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
updateDraft: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 1 | $self->_at_for('app.bsky.draft.updateDraft')->post( 'app.bsky.draft.updateDraft' => { draft => $draft } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 1 | ▶ | method deleteDraft($id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deleteDraft: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 1 | $self->_at_for('app.bsky.draft.deleteDraft')->post( 'app.bsky.draft.deleteDraft' => { id => $id } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | # Contacts (secure contact-import matching) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 1 | ▶ | method getContactMatches(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getContactMatches: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 1 | my $res = $self->_at_for('app.bsky.contact.getMatches')->get( 'app.bsky.contact.getMatches' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 1 | ▶ | $res ? $res->{matches} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"matches"} // ()
MC/DC0%0/2
$res->{"matches"} // ()
$res->{"matches"}
()
Truth table33%1/3
A // B
A= $res->{"matches"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 1 | ▶ | method getContactSyncStatus() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getContactSyncStatus: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 1 | my $res = $self->_at_for('app.bsky.contact.getSyncStatus')->get('app.bsky.contact.getSyncStatus'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 1 | ▶ | $res ? $res->{syncStatus} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"syncStatus"} // ()
MC/DC0%0/2
$res->{"syncStatus"} // ()
$res->{"syncStatus"}
()
Truth table33%1/3
A // B
A= $res->{"syncStatus"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 1 | ▶ | method importContacts(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
importContacts: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 1 | my $res = $self->_at_for('app.bsky.contact.importContacts')->post( 'app.bsky.contact.importContacts' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 1 | ▶ | $res ? $res->{matchesAndContactIndexes} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"matchesAndContactIndexes"} // ()
MC/DC0%0/2
$res->{"matchesAndContactIndexes"} // ()
$res->{"matchesAndContactIndexes"}
()
Truth table33%1/3
A // B
A= $res->{"matchesAndContactIndexes"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 1 | ▶ | method dismissContactMatch($subject) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dismissContactMatch: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 1 | $self->_at_for('app.bsky.contact.dismissMatch')->post( 'app.bsky.contact.dismissMatch' => { subject => $subject } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 1 | ▶ | method removeContactData() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
removeContactData: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 1 | $self->_at_for('app.bsky.contact.removeData')->post('app.bsky.contact.removeData'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 1 | ▶ | method startPhoneVerification($phone) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
startPhoneVerification: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 1 | $self->_at_for('app.bsky.contact.startPhoneVerification')->post( 'app.bsky.contact.startPhoneVerification' => { phone => $phone } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 1 | ▶ | method verifyPhone( $phone, $code ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verifyPhone: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 1 | my $res = $self->_at_for('app.bsky.contact.verifyPhone')->post( 'app.bsky.contact.verifyPhone' => { phone => $phone, code => $code } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 1 | ▶ | $res ? $res->{token} // () : $res; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$res->{"token"} // ()
MC/DC0%0/2
$res->{"token"} // ()
$res->{"token"}
()
Truth table33%1/3
A // B
A= $res->{"token"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | # Age assurance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 1 | ▶ | method beginAgeAssurance(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
beginAgeAssurance: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 1 | $self->_at_for('app.bsky.ageassurance.begin')->post( 'app.bsky.ageassurance.begin' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 1 | ▶ | method getAgeAssuranceConfig() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getAgeAssuranceConfig: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 1 | $self->_at_for('app.bsky.ageassurance.getConfig')->get('app.bsky.ageassurance.getConfig'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 1 | ▶ | method getAgeAssuranceState(%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getAgeAssuranceState: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 1 | $self->_at_for('app.bsky.ageassurance.getState')->get( 'app.bsky.ageassurance.getState' => \%args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | # Utils | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 17 | ▶ | method parse_mentions($text) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_mentions: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 17 | my @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 17 | ▶ | push @spans, { start => $-[1], handle => $2, end => $+[1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | while $text =~ /(?:\A|\W)(@(([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?))/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 17 | @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 17 | ▶ | method parse_urls($text) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_urls: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 17 | my @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | # partial/naive URL regex based on: https://stackoverflow.com/a/3809435 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | # tweaked to disallow some training punctuation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 17 | ▶ | push @spans, { start => $-[1], url => $1, end => $+[1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | while $text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | =~ /(?:\A|\W)(https?:\/\/(www\.)?[-a-zA-Z0-9\@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9\(\)\@:%_\+.~#?&\/\/=]*[-a-zA-Z0-9@%_\+~#\/\/=])?)/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 17 | @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 10 | ▶ | method parse_tags($text) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_tags: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 10 | my @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 10 | ▶ | push @spans, { start => $-[1], tag => $2, end => $+[1] } while $text =~ /(?:\A|\W)(#+(\w{1, 640}))/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 10 | @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 9 | ▶ | method parse_facets($text) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_facets: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 9 | my @facets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 9 | for my $m ( $self->parse_mentions($text) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 3 | my $res = $self->at->get( 'com.atproto.identity.resolveHandle', { handle => $m->{handle} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | # if handle cannot be resolved, just skip it. Bluesky will display it as plain text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 3 | ▶ | $res || next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | push @facets, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | index => { byteStart => $m->{start}, byteEnd => $m->{end} }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 3 | features => [ { '$type' => 'app.bsky.richtext.facet#mention', did => $res->{did} } ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 9 | for my $m ( $self->parse_urls($text) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | push @facets, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | index => { byteStart => $m->{start}, byteEnd => $m->{end} }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 4 | features => [ { '$type' => 'app.bsky.richtext.facet#link', uri => $m->{url} } ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 9 | for my $m ( $self->parse_tags($text) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | push @facets, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | index => { byteStart => $m->{start}, byteEnd => $m->{end} }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 3 | features => [ { '$type' => 'app.bsky.richtext.facet#tag', tag => $m->{tag} } ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 9 | @facets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 11 | ▶ | method parse_uri($uri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_uri: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 11 | require At::Protocol::URI; # Should already be loaded but... | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 11 | ▶ | $uri = At::Protocol::URI->new($uri) unless builtin::blessed $uri; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 11 | { repo => $uri->host, collection => $uri->collection, rkey => $uri->rkey }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 5 | ▶ | method getReplyRefs($parent_uri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getReplyRefs: called CC=4 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 5 | my $res = $self->at->get( 'com.atproto.repo.getRecord', $self->parse_uri($parent_uri) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 5 | ▶ | $res || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 5 | my $root = my $parent = $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 5 | ▶ | if ( $parent->{value}{reply} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 2 | $root = $self->at->get( 'com.atproto.repo.getRecord', $self->parse_uri( $parent->{value}{reply}{root}{uri} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 2 | ▶ | $res ||= $parent; # escape hatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$res ||= $parent
MC/DC0%0/2
$res ||= $parent
$res
$parent
Truth table33%1/3
A ||= B
A= $resB= $parent
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 5 | { root => { uri => $root->{uri}, cid => $root->{cid} }, parent => { uri => $parent->{uri}, cid => $parent->{cid} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | ▶ | method uploadFile( $bytes, $mime_type //= undef ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uploadFile: not called CC=47 SCAR=77.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 0 | ▶ | if ( builtin::blessed $bytes ) { $bytes = $bytes->slurp_raw } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | ▶ | elsif ( !ref $bytes && $bytes !~ /[\x00-\x1f]/ && -e $bytes ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
not ref $bytes || $bytes =~ /[\x00-\x1f]/d and -e $bytes
ref $bytes || $bytes =~ /[\x00-\x1f]/d
MC/DC0%0/3
not ref $bytes || $bytes =~ /[\x00-\x1f]/d and -e $bytes
ref $bytes
$bytes =~ /[\x00-\x1f]/d
-e $bytes
Truth table0%0/4
not(A || B) and C
A= ref $bytesB= $bytes =~ /[\x00-\x1f]/dC= -e $bytes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | $bytes = path($bytes)->slurp_raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | # TODO: a non-naive implementation would strip EXIF metadata from JPEG files here by default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 0 | ▶ | my $determined_mime | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 10 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | = defined $mime_type ? $mime_type : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | ( $bytes =~ /^GIF89a/ ? 'image/gif' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | $bytes =~ /^.{2}JFIF/ ? 'image/jpeg' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | $bytes =~ /^.{4}PNG\r\n\x1a\n/ ? 'image/png' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | $bytes =~ /^.{8}BM/ ? 'image/bmp' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | $bytes =~ /^.{4}(II|MM)\x42\x4D/ ? 'image/tiff' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | $bytes =~ /^.{4}8BPS/ ? 'image/psd' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | $bytes =~ /^data:image\/svg\+xml;/ ? 'image/svg+xml' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | $bytes =~ /^.{4}ftypqt / ? 'video/quicktime' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | $bytes =~ /^.{4}ftyp(isom|mp4[12]?|MSNV|M4[v|a]|f4v)/i ? 'video/mp4' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 'application/octet-stream' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 0 | my $at_http = $self->at->http; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 0 | my $url = sprintf( '%s/xrpc/%s', $self->at->host, 'com.atproto.repo.uploadBlob' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 0 | my %headers = ( 'Content-Type' => $determined_mime ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | ▶ | if ( $at_http && $at_http->can('auth') && $at_http->auth ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$at_http and $at_http->can("auth") and $at_http->auth
$at_http and $at_http->can("auth")
MC/DC0%0/3
$at_http and $at_http->can("auth") and $at_http->auth
$at_http
$at_http->can("auth")
$at_http->auth
Truth table0%0/4
A and B and C
A= $at_httpB= $at_http->can("auth")C= $at_http->auth
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | $headers{'Authorization'} = $at_http->auth; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 0 | ▶ | if ( $at_http && $at_http->can('token_type') && $at_http->token_type eq 'DPoP' && $at_http->can('_generate_dpop_proof') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$at_http and $at_http->can("token_type") and $at_http->token_type eq "DPoP" and $at_http->can("_generate_dpop_proof")
$at_http and $at_http->can("token_type") and $at_http->token_type eq "DPoP"
$at_http and $at_http->can("token_type")
MC/DC0%0/4
$at_http and $at_http->can("token_type") and $at_http->token_type eq "DPoP" and $at_http->can("_generate_dpop_proof")
$at_http
$at_http->can("token_type")
$at_http->token_type eq "DPoP"
$at_http->can("_generate_dpop_proof")
Truth table0%0/5
A and B and C and D
A= $at_httpB= $at_http->can("token_type")C= $at_http->token_type eq "DPoP"D= $at_http->can("_generate_dpop_proof")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | $headers{DPoP} = $at_http->_generate_dpop_proof( $url, 'POST' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | ▶ | state $http //= HTTP::Tiny->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
state $http //= "HTTP::Tiny"->new
MC/DC0%0/2
state $http //= "HTTP::Tiny"->new
state $http
"HTTP::Tiny"->new
Truth table0%0/3
A //= B
A= state $httpB= "HTTP::Tiny"->new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 0 | my $res = $http->post( $url, { content => $bytes, headers => \%headers } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | my $content = $res->{content}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | # Retry on DPoP nonce issues | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | ▶ | if ( !$res->{success} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 0 | my $body = $content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 0 | ▶ | if ( $body && !ref $body && ( $res->{status} == 401 || $res->{status} == 400 ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$body and not ref $body and $res->{"status"} == 401 || $res->{"status"} == 400
$body and not ref $body
$res->{"status"} == 401 or $res->{"status"} == 400
MC/DC0%0/4
$body and not ref $body and $res->{"status"} == 401 || $res->{"status"} == 400
$body
not ref $body
$res->{"status"} == 401
$res->{"status"} == 400
Truth table0%0/5
A and not(B) and C or D
A= $bodyB= not ref $bodyC= $res->{"status"} == 401D= $res->{"status"} == 400
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | ▶ | if ( $body =~ /use_dpop_nonce|dpop_nonce|required nonce|nonce in dpop|DPoP.*nonce/i && $at_http && $at_http->can('dpop_nonce') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$body =~ /use_dpop_nonce|dpop_nonce|required nonce|nonce in dpop|DPoP.*nonce/di and $at_http and $at_http->can("dpop_nonce")
$body =~ /use_dpop_nonce|dpop_nonce|required nonce|nonce in dpop|DPoP.*nonce/di and $at_http
MC/DC0%0/3
$body =~ /use_dpop_nonce|dpop_nonce|required nonce|nonce in dpop|DPoP.*nonce/di and $at_http and $at_http->can("dpop_nonce")
$body =~ /use_dpop_nonce|dpop_nonce|required nonce|nonce in dpop|DPoP.*nonce/di
$at_http
$at_http->can("dpop_nonce")
Truth table0%0/4
A and B and C
A= $body =~ /use_dpop_nonce|dpop_nonce|required nonce|nonce in dpop|DPoP.*nonce/diB= $at_httpC= $at_http->can("dpop_nonce")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | my $nonce; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 0 | foreach my $k ( keys %{ $res->{headers} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | ▶ | if ( lc($k) eq 'dpop-nonce' ) { $nonce = $res->{headers}{$k}; last; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 0 | ▶ | $at_http->dpop_nonce($nonce) if defined $nonce && $nonce ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $nonce and $nonce ne ""
MC/DC0%0/2
defined $nonce and $nonce ne ""
defined $nonce
$nonce ne ""
Truth table0%0/3
A and B
A= defined $nonceB= $nonce ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 0 | ▶ | if ( $at_http && $at_http->can('_generate_dpop_proof') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$at_http and $at_http->can("_generate_dpop_proof")
MC/DC0%0/2
$at_http and $at_http->can("_generate_dpop_proof")
$at_http
$at_http->can("_generate_dpop_proof")
Truth table0%0/3
A and B
A= $at_httpB= $at_http->can("_generate_dpop_proof")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 0 | $headers{DPoP} = $at_http->_generate_dpop_proof( $url, 'POST' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 0 | $res = $http->post( $url, { content => $bytes, headers => \%headers } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 0 | $content = $res->{content}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 0 | ▶ | if ( $res->{success} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 0 | ▶ | $content = decode_json($content) if $content && ( $res->{headers}{'content-type'} // '' ) =~ m[json]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$content and ($res->{"headers"}{"content-type"} // "") =~ /json/d
$res->{"headers"}{"content-type"} // ""
MC/DC0%0/2
$content and ($res->{"headers"}{"content-type"} // "") =~ /json/d
$content
$res->{"headers"}{"content-type"}
Truth table0%0/3
A and B
A= $contentB= $res->{"headers"}{"content-type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | return $content->{blob}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 0 | ▶ | my $msg = $res->{reason} // 'Unknown error'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$res->{"reason"} // "Unknown error"
MC/DC0%0/1
$res->{"reason"} // "Unknown error"
$res->{"reason"}
Truth table0%0/2
A
A= $res->{"reason"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | ▶ | if ( $content && ( $res->{headers}{'content-type'} // '' ) =~ m[json] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$content and ($res->{"headers"}{"content-type"} // "") =~ /json/d
$res->{"headers"}{"content-type"} // ""
MC/DC0%0/2
$content and ($res->{"headers"}{"content-type"} // "") =~ /json/d
$content
$res->{"headers"}{"content-type"}
Truth table0%0/3
A and B
A= $contentB= $res->{"headers"}{"content-type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 0 | my $json = decode_json($content); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | ▶ | $msg .= ': ' . $json->{message} if $json->{message}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 0 | return At::Error->new( message => $msg, fatal => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | # Upload a single image (path, bytes, handle, or Path::Tiny object), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | # enforcing the 1 MB legacy image guard, and return its blob. Shared by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | # the images and gallery embeds. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | ▶ | method _upload_image ( $img, $mime = undef ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_upload_image: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | ▶ | if ( builtin::blessed $img && $img->can('slurp_raw') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
builtin::blessed($img) and $img->can("slurp_raw")
MC/DC0%0/2
builtin::blessed($img) and $img->can("slurp_raw")
builtin::blessed($img)
$img->can("slurp_raw")
Truth table0%0/3
A and B
A= builtin::blessed($img)B= $img->can("slurp_raw")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | ▶ | my $sz = $img->can('size') ? $img->size : length( $img->slurp_raw ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | ▶ | At::Error->new( message => 'image file size too large. 1000000 bytes maximum, got: ' . $sz )->throw if $sz > 1000000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 0 | $img = $img->slurp_raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | ▶ | elsif ( !ref $img && $img !~ /[\x00-\x1f]/ && -e $img ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
not ref $img || $img =~ /[\x00-\x1f]/d and -e $img
ref $img || $img =~ /[\x00-\x1f]/d
MC/DC0%0/3
not ref $img || $img =~ /[\x00-\x1f]/d and -e $img
ref $img
$img =~ /[\x00-\x1f]/d
-e $img
Truth table0%0/4
not(A || B) and C
A= ref $imgB= $img =~ /[\x00-\x1f]/dC= -e $img
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 0 | my $p = path($img); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 0 | my $sz = $p->size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 0 | ▶ | At::Error->new( message => 'image file size too large. 1000000 bytes maximum, got: ' . $sz )->throw if $sz > 1000000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 0 | $img = $p->slurp_raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 0 | my $sz = length $img; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 0 | ▶ | At::Error->new( message => 'image file size too large. 1000000 bytes maximum, got: ' . $sz )->throw if $sz > 1000000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 0 | my $blob = $self->uploadFile( $img, $mime ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | ▶ | builtin::blessed($blob) && $blob->isa('At::Error') ? $blob->throw : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($blob) and $blob->isa("At::Error")
MC/DC0%0/2
builtin::blessed($blob) and $blob->isa("At::Error")
builtin::blessed($blob)
$blob->isa("At::Error")
Truth table0%0/3
A and B
A= builtin::blessed($blob)B= $blob->isa("At::Error")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | ▶ | $blob || At::Error->new( message => 'upload failed', fatal => 1 )->throw; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | $blob; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | # app.bsky.embed.images - up to 4 images, each { image, alt, [aspectRatio] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 0 | ▶ | method uploadImages(@images) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uploadImages: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 0 | my @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 0 | for my $img (@images) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 0 | my ( $alt, $mime, $aspectRatio ) = ( '', undef, undef ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 0 | ▶ | if ( ( builtin::reftype($img) // '' ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
builtin::reftype($img) // ""
MC/DC0%0/1
builtin::reftype($img) // ""
builtin::reftype($img)
Truth table0%0/2
A
A= builtin::reftype($img)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 0 | ▶ | $alt = $img->{alt} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$img->{"alt"} // ""
MC/DC0%0/1
$img->{"alt"} // ""
$img->{"alt"}
Truth table0%0/2
A
A= $img->{"alt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 0 | ▶ | $mime = $img->{mime} // (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$img->{"mime"} // ()
MC/DC0%0/2
$img->{"mime"} // ()
$img->{"mime"}
()
Truth table0%0/3
A // B
A= $img->{"mime"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 0 | $aspectRatio = $img->{aspectRatio}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 0 | $img = $img->{image}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 0 | my $blob = $self->_upload_image( $img, $mime ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 0 | ▶ | push @ret, { alt => $alt, image => $blob, ( defined $aspectRatio ? ( aspectRatio => $aspectRatio ) : () ), }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 0 | { '$type' => 'app.bsky.embed.images', images => \@ret }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | # app.bsky.embed.gallery - up to 20 media items (soft limit 10 in clients), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | # each item being an app.bsky.embed.gallery#image { image, alt, [aspectRatio] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 0 | ▶ | method uploadGallery(@items) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uploadGallery: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 0 | my @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 0 | for my $item (@items) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 0 | my ( $alt, $mime, $aspectRatio ) = ( '', undef, undef ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 0 | ▶ | if ( ( builtin::reftype($item) // '' ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
builtin::reftype($item) // ""
MC/DC0%0/1
builtin::reftype($item) // ""
builtin::reftype($item)
Truth table0%0/2
A
A= builtin::reftype($item)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 0 | ▶ | $alt = $item->{alt} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$item->{"alt"} // ""
MC/DC0%0/1
$item->{"alt"} // ""
$item->{"alt"}
Truth table0%0/2
A
A= $item->{"alt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 0 | ▶ | $mime = $item->{mime} // (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$item->{"mime"} // ()
MC/DC0%0/2
$item->{"mime"} // ()
$item->{"mime"}
()
Truth table0%0/3
A // B
A= $item->{"mime"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 0 | $aspectRatio = $item->{aspectRatio}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 0 | $item = $item->{image}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 0 | my $blob = $self->_upload_image( $item, $mime ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | 0 | ▶ | push @ret, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | '$type' => 'app.bsky.embed.gallery#image', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | image => $blob, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | alt => $alt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | ( defined $aspectRatio ? ( aspectRatio => $aspectRatio ) : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 0 | { '$type' => 'app.bsky.embed.gallery', items => \@ret }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 0 | ▶ | method uploadVideoCaption( $lang, $caption ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uploadVideoCaption: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 0 | ▶ | if ( builtin::blessed $caption && $caption->can('slurp_raw') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($caption) and $caption->can("slurp_raw")
MC/DC0%0/2
builtin::blessed($caption) and $caption->can("slurp_raw")
builtin::blessed($caption)
$caption->can("slurp_raw")
Truth table0%0/3
A and B
A= builtin::blessed($caption)B= $caption->can("slurp_raw")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 0 | ▶ | my $sz = $caption->can('size') ? $caption->size : length( $caption->slurp_raw ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 0 | ▶ | At::Error->new( message => 'caption file size too large. 20000 bytes maximum, got: ' . $sz )->throw if $sz > 20000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 0 | $caption = $caption->slurp_raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 0 | my $sz = length $caption; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 0 | ▶ | At::Error->new( message => 'caption file size too large. 20000 bytes maximum, got: ' . $sz )->throw if $sz > 20000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 0 | my $blob = $self->uploadFile( $caption, 'text/vtt' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 0 | ▶ | builtin::blessed($blob) && $blob->isa('At::Error') ? $blob->throw : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($blob) and $blob->isa("At::Error")
MC/DC0%0/2
builtin::blessed($blob) and $blob->isa("At::Error")
builtin::blessed($blob)
$blob->isa("At::Error")
Truth table0%0/3
A and B
A= builtin::blessed($blob)B= $blob->isa("At::Error")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 0 | ▶ | $blob || At::Error->new( message => 'upload failed', fatal => 1 )->throw; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 0 | { '$type' => 'app.bsky.embed.video#caption', lang => $lang, file => $blob }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | # Build an app.bsky.embed.video from an already-uploaded blob (for example | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | # the processed blob returned by getVideoJobStatus after uploadVideoJob). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | # %opts: alt, aspectRatio, presentation (default|gif), captions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | # (either { lang => file } or [ { lang => ..., file => ... } ]). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 0 | ▶ | method videoEmbed ( $blob, %opts ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
videoEmbed: not called CC=15 SCAR=54.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 0 | my @captions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 0 | ▶ | if ( defined $opts{captions} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | 0 | my $captions = $opts{captions}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 0 | ▶ | if ( ( builtin::reftype($captions) // '' ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
builtin::reftype($captions) // ""
MC/DC0%0/1
builtin::reftype($captions) // ""
builtin::reftype($captions)
Truth table0%0/2
A
A= builtin::reftype($captions)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | 0 | @captions = map { $self->uploadVideoCaption( $_, $captions->{$_} ) } sort keys %$captions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | ▶ | elsif ( ( builtin::reftype($captions) // '' ) eq 'ARRAY' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
builtin::reftype($captions) // ""
MC/DC0%0/1
builtin::reftype($captions) // ""
builtin::reftype($captions)
Truth table0%0/2
A
A= builtin::reftype($captions)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 0 | for my $c (@$captions) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 0 | ▶ | next unless ( builtin::reftype($c) // '' ) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
builtin::reftype($c) // ""
MC/DC0%0/1
builtin::reftype($c) // ""
builtin::reftype($c)
Truth table0%0/2
A
A= builtin::reftype($c)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 0 | ▶ | push @captions, $self->uploadVideoCaption( $c->{lang}, $c->{file} // $c->{caption} // $c->{vtt} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
($c->{"file"} // $c->{"caption"}) // $c->{"vtt"}
$c->{"file"} // $c->{"caption"}
MC/DC0%0/3
($c->{"file"} // $c->{"caption"}) // $c->{"vtt"}
$c->{"file"}
$c->{"caption"}
$c->{"vtt"}
Truth table0%0/4
A // B // C
A= $c->{"file"}B= $c->{"caption"}C= $c->{"vtt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | { '$type' => 'app.bsky.embed.video', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | video => $blob, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | ( @captions ? ( captions => \@captions ) : () ), ( defined $opts{alt} ? ( alt => $opts{alt} ) : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | ( defined $opts{aspectRatio} ? ( aspectRatio => $opts{aspectRatio} ) : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | ▶ | ( defined $opts{presentation} ? ( presentation => $opts{presentation} ) : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 0 | ▶ | method uploadVideo($vid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uploadVideo: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | 0 | my ( $alt, $mime, $aspectRatio, $presentation, $captions ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 0 | ▶ | if ( ( builtin::reftype($vid) // '' ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
builtin::reftype($vid) // ""
MC/DC0%0/1
builtin::reftype($vid) // ""
builtin::reftype($vid)
Truth table0%0/2
A
A= builtin::reftype($vid)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 0 | $alt = $vid->{alt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 0 | ▶ | $mime = $vid->{mime} // (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$vid->{"mime"} // ()
MC/DC0%0/2
$vid->{"mime"} // ()
$vid->{"mime"}
()
Truth table0%0/3
A // B
A= $vid->{"mime"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 0 | $aspectRatio = $vid->{aspectRatio}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 0 | $presentation = $vid->{presentation}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 0 | $captions = $vid->{captions}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | $vid = $vid->{video}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | ▶ | if ( builtin::blessed $vid && $vid->can('slurp_raw') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
builtin::blessed($vid) and $vid->can("slurp_raw")
MC/DC0%0/2
builtin::blessed($vid) and $vid->can("slurp_raw")
builtin::blessed($vid)
$vid->can("slurp_raw")
Truth table0%0/3
A and B
A= builtin::blessed($vid)B= $vid->can("slurp_raw")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | 0 | ▶ | my $szv = $vid->can('size') ? $vid->size : length( $vid->slurp_raw ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 0 | ▶ | At::Error->new( message => 'video file size too large. 50000000 bytes maximum, got: ' . $szv )->throw if $szv > 50000000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 0 | $vid = $vid->slurp_raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | ▶ | elsif ( !ref $vid && $vid !~ /[\x00-\x1f]/ && -e $vid ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
not ref $vid || $vid =~ /[\x00-\x1f]/d and -e $vid
ref $vid || $vid =~ /[\x00-\x1f]/d
MC/DC0%0/3
not ref $vid || $vid =~ /[\x00-\x1f]/d and -e $vid
ref $vid
$vid =~ /[\x00-\x1f]/d
-e $vid
Truth table0%0/4
not(A || B) and C
A= ref $vidB= $vid =~ /[\x00-\x1f]/dC= -e $vid
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | 0 | my $pv = path($vid); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 0 | ▶ | At::Error->new( message => 'video file size too large. 50000000 bytes maximum, got: ' . $pv->size )->throw if $pv->size > 50000000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 0 | $vid = $pv->slurp_raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 0 | ▶ | At::Error->new( message => 'video file size too large. 50000000 bytes maximum, got: ' . length $vid )->throw if length $vid > 50000000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 0 | my $blob = $self->uploadFile( $vid, $mime ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 0 | ▶ | builtin::blessed($blob) && $blob->isa('At::Error') ? $blob->throw : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($blob) and $blob->isa("At::Error")
MC/DC0%0/2
builtin::blessed($blob) and $blob->isa("At::Error")
builtin::blessed($blob)
$blob->isa("At::Error")
Truth table0%0/3
A and B
A= builtin::blessed($blob)B= $blob->isa("At::Error")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 0 | ▶ | $blob || At::Error->new( message => 'upload failed', fatal => 1 )->throw; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | 0 | return $self->videoEmbed( $blob, alt => $alt, aspectRatio => $aspectRatio, presentation => $presentation, captions => $captions ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 2 | ▶ | method getEmbedRef($uri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getEmbedRef: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 2 | my $res = $self->at->get( 'com.atproto.repo.getRecord', $self->parse_uri($uri) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | 2 | ▶ | $res || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 2 | { '$type' => 'app.bsky.embed.record', record => { uri => $res->{uri}, cid => $res->{cid} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | 0 | ▶ | method fetch_embed_url_card($url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch_embed_url_card: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | 0 | my %card = ( uri => $url, title => '', description => '' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 0 | ▶ | state $http //= HTTP::Tiny->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
state $http //= "HTTP::Tiny"->new
MC/DC0%0/2
state $http //= "HTTP::Tiny"->new
state $http
"HTTP::Tiny"->new
Truth table0%0/3
A //= B
A= state $httpB= "HTTP::Tiny"->new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | 0 | my $res = $http->get($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | 0 | ▶ | if ( $res->{success} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 0 | ( $card{title} ) = $res->{content} =~ m[<title>(.*?)</title>.*</head>]is; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | 0 | ▶ | ( $card{description} ) = ( $res->{content} =~ m[<meta name="description" content="(.*?)".+</meta>.*</head>]is ) // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$res->{"content"} =~ m[<meta name="description" content="(.*?)".+</meta>.*</head>]dis // ""
MC/DC0%0/1
$res->{"content"} =~ m[<meta name="description" content="(.*?)".+</meta>.*</head>]dis // ""
$res->{"content"} =~ m[<meta name="description" content="(.*?)".+</meta>.*</head>]dis
Truth table0%0/2
A
A= $res->{"content"} =~ m[<meta name="description" content="(.*?)".+</meta>.*</head>]dis
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 0 | my ($image) = $res->{content} =~ m[<img.*?src="([^"]*)"[^>]*>(?:</img>)?]isp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | 0 | ▶ | if ( defined $image ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | 0 | ▶ | if ( $image =~ /^data:/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 0 | $card{thumb} = $self->uploadFile($image); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 0 | $res = $http->get( URI->new_abs( $image, $url ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 0 | ▶ | $card{thumb} = $res->{success} ? $self->uploadFile( $res->{content}, $res->{headers}{'content-type'} ) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 0 | { '$type' => 'app.bsky.embed.external', external => \%card }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||