summaryrefslogtreecommitdiff
path: root/lib/Dakkar/NotesArchive.pm
blob: b576b4ac49c465a2d4b27cf11f9afa281dfea156 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package Dakkar::NotesArchive; 
use v5.36;
use Moo;
use experimental 'builtin';
use PerlX::Maybe;
use Dakkar::Misskey;
use Types::Standard qw(Str InstanceOf);
use namespace::clean;
 
has [qw(base_url token user_id)] => (
    is => 'ro',
    required => 1,
    isa => Str,
);
 
has client => (
    is => 'lazy',
    isa => InstanceOf['Dakkar::Misskey'],
);
 
 
sub _build_client($self) {
    my $nt = Dakkar::Misskey->new({
        base_url => $self->base_url,
        token => $self->token,
    });
}
 
sub timeline($self$since_id$cb=undef) {
    return $self->client->timeline({
        maybe sinceId => $since_id,
        includeMyRenotes => \1,
        includeLocalRenotes => \1,
        includeRenotedMyNotes => \0,
    }, $cb);
}
 
sub following($self) {
    return [
        map { $_->{followee} }
        $self->client->following($self->user_id)->@*
    ];
}
 
sub followers($self) {
    return [
        map { $_->{follower} }
        $self->client->followers($self->user_id)->@*
    ];
}
 
1;