| 1 | package WebService::Mattermost::V4::API::Object::Channel; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: A channel item. | ||||||||||
| 4 | |||||||||||
| 5 | 12 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 12 | ▶ | use Types::Standard qw(HashRef InstanceOf Int Maybe Str); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 12 | extends 'WebService::Mattermost::V4::API::Object'; | |||||||||
| 9 | 12 | with qw( | |||||||||
| 10 | WebService::Mattermost::V4::API::Object::Role::APIMethods | ||||||||||
| 11 | WebService::Mattermost::V4::API::Object::Role::Timestamps | ||||||||||
| 12 | WebService::Mattermost::V4::API::Object::Role::BelongingToUser | ||||||||||
| 13 | WebService::Mattermost::V4::API::Object::Role::BelongingToTeam | ||||||||||
| 14 | WebService::Mattermost::V4::API::Object::Role::ID | ||||||||||
| 15 | WebService::Mattermost::V4::API::Object::Role::Name | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | ################################################################################ | ||||||||||
| 19 | |||||||||||
| 20 | 12 | has [ qw( | |||||||||
| 21 | extra_updated_at | ||||||||||
| 22 | last_post_at | ||||||||||
| 23 | ) ] => (is => 'ro', isa => Maybe[InstanceOf['DateTime']], lazy => 1, builder => 1); | ||||||||||
| 24 | |||||||||||
| 25 | 12 | has [ qw( | |||||||||
| 26 | display_name | ||||||||||
| 27 | header | ||||||||||
| 28 | purpose | ||||||||||
| 29 | type | ||||||||||
| 30 | ) ] => (is => 'ro', isa => Maybe[Str], lazy => 1, builder => 1); | ||||||||||
| 31 | |||||||||||
| 32 | 12 | has [ qw( | |||||||||
| 33 | total_message_count | ||||||||||
| 34 | ) ] => (is => 'ro', isa => Maybe[Int], lazy => 1, builder => 1); | ||||||||||
| 35 | |||||||||||
| 36 | ################################################################################ | ||||||||||
| 37 | |||||||||||
| 38 | sub BUILD { | ||||||||||
| 39 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 40 | |||||||||||
| 41 | 0 | $self->api_resource_name('channel'); | |||||||||
| 42 | 0 | $self->set_available_api_methods([ qw( | |||||||||
| 43 | delete | ||||||||||
| 44 | get | ||||||||||
| 45 | patch | ||||||||||
| 46 | pinned | ||||||||||
| 47 | posts | ||||||||||
| 48 | restore | ||||||||||
| 49 | set_scheme | ||||||||||
| 50 | stats | ||||||||||
| 51 | toggle_private_status | ||||||||||
| 52 | update | ||||||||||
| 53 | ) ]); | ||||||||||
| 54 | |||||||||||
| 55 | 0 | return 1; | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | ################################################################################ | ||||||||||
| 59 | |||||||||||
| 60 | sub _build_extra_updated_at { | ||||||||||
| 61 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_extra_updated_at: not called CC=1 SCAR=6.9
| |||||||||||
| 62 | |||||||||||
| 63 | 0 | return $self->_from_epoch($self->raw_data->{extra_updated_at}); | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | sub _build_display_name { | ||||||||||
| 67 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_display_name: not called CC=1 SCAR=6.9
| |||||||||||
| 68 | |||||||||||
| 69 | 0 | return $self->raw_data->{display_name}; | |||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | sub _build_header { | ||||||||||
| 73 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_header: not called CC=1 SCAR=6.9
| |||||||||||
| 74 | |||||||||||
| 75 | 0 | return $self->raw_data->{header}; | |||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | sub _build_purpose { | ||||||||||
| 79 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_purpose: not called CC=1 SCAR=6.9
| |||||||||||
| 80 | |||||||||||
| 81 | 0 | return $self->raw_data->{purpose}; | |||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | sub _build_type { | ||||||||||
| 85 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_type: not called CC=2 SCAR=17.9
| |||||||||||
| 86 | |||||||||||
| 87 | 0 | ▶ | return $self->raw_data->{type} eq 'O' ? 'Public' : 'Private'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 88 | } | ||||||||||
| 89 | |||||||||||
| 90 | sub _build_total_message_count { | ||||||||||
| 91 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_total_message_count: not called CC=1 SCAR=6.9
| |||||||||||
| 92 | |||||||||||
| 93 | 0 | return $self->raw_data->{total_message_count}; | |||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | ################################################################################ | ||||||||||
| 97 | |||||||||||
| 98 | 12 | 1; | |||||||||
| 99 | |||||||||||
| 100 | __END__ | ||||||||||
| 101 | |||||||||||
| 102 | =pod | ||||||||||
| 103 | |||||||||||
| 104 | =encoding UTF-8 | ||||||||||
| 105 | |||||||||||
| 106 | =head1 NAME | ||||||||||
| 107 | |||||||||||
| 108 | WebService::Mattermost::V4::API::Object::Channel - A channel item. | ||||||||||
| 109 | |||||||||||
| 110 | =head1 VERSION | ||||||||||
| 111 | |||||||||||
| 112 | version 0.28 | ||||||||||
| 113 | |||||||||||
| 114 | =head1 DESCRIPTION | ||||||||||
| 115 | |||||||||||
| 116 | Details a Mattermost channel object. | ||||||||||
| 117 | |||||||||||
| 118 | =head2 METHODS | ||||||||||
| 119 | |||||||||||
| 120 | See matching methods in L<WebService::Mattermost::V4::API::Resource::Channel> | ||||||||||
| 121 | for full documentation. | ||||||||||
| 122 | |||||||||||
| 123 | ID parameters are not required: | ||||||||||
| 124 | |||||||||||
| 125 | my $response = $mattermost->api->channel->get('ID-HERE')->item->delete(); | ||||||||||
| 126 | |||||||||||
| 127 | Is the same as: | ||||||||||
| 128 | |||||||||||
| 129 | my $response = $mattermost->api->channel->delete('ID-HERE'); | ||||||||||
| 130 | |||||||||||
| 131 | =over 4 | ||||||||||
| 132 | |||||||||||
| 133 | =item C<delete()> | ||||||||||
| 134 | |||||||||||
| 135 | =item C<patch()> | ||||||||||
| 136 | |||||||||||
| 137 | =item C<pinned()> | ||||||||||
| 138 | |||||||||||
| 139 | =item C<posts()> | ||||||||||
| 140 | |||||||||||
| 141 | =item C<restore()> | ||||||||||
| 142 | |||||||||||
| 143 | =item C<set_scheme()> | ||||||||||
| 144 | |||||||||||
| 145 | =item C<stats()> | ||||||||||
| 146 | |||||||||||
| 147 | =item C<toggle_private_status()> | ||||||||||
| 148 | |||||||||||
| 149 | =item C<update()> | ||||||||||
| 150 | |||||||||||
| 151 | =back | ||||||||||
| 152 | |||||||||||
| 153 | =head2 ATTRIBUTES | ||||||||||
| 154 | |||||||||||
| 155 | =over 4 | ||||||||||
| 156 | |||||||||||
| 157 | =item C<extra_updated_at> | ||||||||||
| 158 | |||||||||||
| 159 | A DateTime object for when the channel was updated (extra). | ||||||||||
| 160 | |||||||||||
| 161 | =item C<last_post_at> | ||||||||||
| 162 | |||||||||||
| 163 | A DateTime object for when the channel was last posted to. | ||||||||||
| 164 | |||||||||||
| 165 | =item C<creator_id> | ||||||||||
| 166 | |||||||||||
| 167 | The ID of the user who created the channel. | ||||||||||
| 168 | |||||||||||
| 169 | =item C<display_name> | ||||||||||
| 170 | |||||||||||
| 171 | The channel's display name. | ||||||||||
| 172 | |||||||||||
| 173 | =item C<header> | ||||||||||
| 174 | |||||||||||
| 175 | The channel's topic | ||||||||||
| 176 | |||||||||||
| 177 | =item C<id> | ||||||||||
| 178 | |||||||||||
| 179 | The channel's ID. | ||||||||||
| 180 | |||||||||||
| 181 | =item C<name> | ||||||||||
| 182 | |||||||||||
| 183 | The channel's real name. | ||||||||||
| 184 | |||||||||||
| 185 | =item C<purpose> | ||||||||||
| 186 | |||||||||||
| 187 | A description of what the channel is for. | ||||||||||
| 188 | |||||||||||
| 189 | =item C<team_id> | ||||||||||
| 190 | |||||||||||
| 191 | The ID of the team the channel belongs to. | ||||||||||
| 192 | |||||||||||
| 193 | =item C<type> | ||||||||||
| 194 | |||||||||||
| 195 | The channel's access type (either "Public" or "Private", translated from "O" or | ||||||||||
| 196 | "P" respectively). | ||||||||||
| 197 | |||||||||||
| 198 | =item C<total_message_count> | ||||||||||
| 199 | |||||||||||
| 200 | The number of messages made in the channel. | ||||||||||
| 201 | |||||||||||
| 202 | =back | ||||||||||
| 203 | |||||||||||
| 204 | =head1 SEE ALSO | ||||||||||
| 205 | |||||||||||
| 206 | =over 4 | ||||||||||
| 207 | |||||||||||
| 208 | =item L<WebService::Mattermost::V4::API::Resource::Channel> | ||||||||||
| 209 | |||||||||||
| 210 | =item L<WebService::Mattermost::V4::API::Object::Role::Timestamps> | ||||||||||
| 211 | |||||||||||
| 212 | =item L<WebService::Mattermost::V4::API::Object::Role::BelongingToUser> | ||||||||||
| 213 | |||||||||||
| 214 | =item L<WebService::Mattermost::V4::API::Object::Role::BelongingToTeam> | ||||||||||
| 215 | |||||||||||
| 216 | =item L<WebService::Mattermost::V4::API::Object::Role::ID> | ||||||||||
| 217 | |||||||||||
| 218 | =item L<WebService::Mattermost::V4::API::Object::Role::Name> | ||||||||||
| 219 | |||||||||||
| 220 | =item L<Channel documentation|https://api.mattermost.com/#tag/channels> | ||||||||||
| 221 | |||||||||||
| 222 | =back | ||||||||||
| 223 | |||||||||||
| 224 | =head1 AUTHOR | ||||||||||
| 225 | |||||||||||
| 226 | Mike Jones <mike@netsplit.org.uk> | ||||||||||
| 227 | |||||||||||
| 228 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 229 | |||||||||||
| 230 | This software is Copyright (c) 2020 by Mike Jones. | ||||||||||
| 231 | |||||||||||
| 232 | This is free software, licensed under: | ||||||||||
| 233 | |||||||||||
| 234 | The MIT (X11) License | ||||||||||
| 235 | |||||||||||
| 236 | =cut | ||||||||||