| 1 | package WebService::Mattermost::V4::API::Object::Thread; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: A message thread. | ||||||||||
| 4 | |||||||||||
| 5 | 12 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 12 | ▶ | use Types::Standard qw(ArrayRef Maybe); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 12 | ▶ | use WebService::Mattermost::V4::API::Object::Post; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 12 | extends 'WebService::Mattermost::V4::API::Object'; | |||||||||
| 11 | |||||||||||
| 12 | ################################################################################ | ||||||||||
| 13 | |||||||||||
| 14 | 12 | has [ qw( | |||||||||
| 15 | order | ||||||||||
| 16 | matches | ||||||||||
| 17 | posts | ||||||||||
| 18 | ) ] => (is => 'ro', isa => Maybe[ArrayRef], lazy => 1, builder => 1); | ||||||||||
| 19 | |||||||||||
| 20 | ################################################################################ | ||||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | sub _build_order { shift->raw_data->{order} } | ||||||||
|
Subroutine
_build_order: not called CC=1 SCAR=6.9
| |||||||||||
| 23 | 0 | ▶ | sub _build_matches { shift->raw_data->{matches} } | ||||||||
|
Subroutine
_build_matches: not called CC=1 SCAR=6.9
| |||||||||||
| 24 | |||||||||||
| 25 | sub _build_posts { | ||||||||||
| 26 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_posts: not called CC=3 SCAR=24.8
| |||||||||||
| 27 | |||||||||||
| 28 | 0 | my @posts; | |||||||||
| 29 | |||||||||||
| 30 | 0 | foreach my $post (keys %{$self->raw_data->{posts}}) { | |||||||||
| 31 | push @posts, WebService::Mattermost::V4::API::Object::Post | ||||||||||
| 32 | 0 | ->new($self->_related_args($self->raw_data->{posts}->{$post})); | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | if (scalar @posts) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | @posts = sort { $a->create_at <=> $b->create_at } @posts; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 0 | return \@posts; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | ################################################################################ | ||||||||||
| 43 | |||||||||||
| 44 | 12 | 1; | |||||||||
| 45 | |||||||||||
| 46 | __END__ | ||||||||||
| 47 | |||||||||||
| 48 | =pod | ||||||||||
| 49 | |||||||||||
| 50 | =encoding UTF-8 | ||||||||||
| 51 | |||||||||||
| 52 | =head1 NAME | ||||||||||
| 53 | |||||||||||
| 54 | WebService::Mattermost::V4::API::Object::Thread - A message thread. | ||||||||||
| 55 | |||||||||||
| 56 | =head1 VERSION | ||||||||||
| 57 | |||||||||||
| 58 | version 0.28 | ||||||||||
| 59 | |||||||||||
| 60 | =head1 DESCRIPTION | ||||||||||
| 61 | |||||||||||
| 62 | Describes a list of Mattermost posts. | ||||||||||
| 63 | |||||||||||
| 64 | =head2 ATTRIBUTES | ||||||||||
| 65 | |||||||||||
| 66 | =over 4 | ||||||||||
| 67 | |||||||||||
| 68 | =item C<matches> | ||||||||||
| 69 | |||||||||||
| 70 | If the posts are a search result, a list of strings that match. | ||||||||||
| 71 | |||||||||||
| 72 | =item C<order> | ||||||||||
| 73 | |||||||||||
| 74 | =item C<posts> | ||||||||||
| 75 | |||||||||||
| 76 | An arrayref of posts in the list, ordered by date created. | ||||||||||
| 77 | |||||||||||
| 78 | =back | ||||||||||
| 79 | |||||||||||
| 80 | =head1 AUTHOR | ||||||||||
| 81 | |||||||||||
| 82 | Mike Jones <mike@netsplit.org.uk> | ||||||||||
| 83 | |||||||||||
| 84 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 85 | |||||||||||
| 86 | This software is Copyright (c) 2020 by Mike Jones. | ||||||||||
| 87 | |||||||||||
| 88 | This is free software, licensed under: | ||||||||||
| 89 | |||||||||||
| 90 | The MIT (X11) License | ||||||||||
| 91 | |||||||||||
| 92 | =cut | ||||||||||