blib/lib/WebService/Mattermost/V4/API/Object/Channel.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 6 | 22 | 27.2 |
branch | 0 | 2 | 0.0 |
condition | n/a | ||
subroutine | 2 | 9 | 22.2 |
pod | 0 | 1 | 0.0 |
total | 8 | 34 | 23.5 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package WebService::Mattermost::V4::API::Object::Channel; 2: 3: # ABSTRACT: A channel item. 4: 5: use Moo; 6: use Types::Standard qw(HashRef InstanceOf Int Maybe Str); 7: 8: extends 'WebService::Mattermost::V4::API::Object'; 9: 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: has [ qw( 21: extra_updated_at 22: last_post_at 23: ) ] => (is => 'ro', isa => Maybe[InstanceOf['DateTime']], lazy => 1, builder => 1); 24: 25: has [ qw( 26: display_name 27: header 28: purpose 29: type 30: ) ] => (is => 'ro', isa => Maybe[Str], lazy => 1, builder => 1); 31: 32: has [ qw( 33: total_message_count 34: ) ] => (is => 'ro', isa => Maybe[Int], lazy => 1, builder => 1); 35: 36: ################################################################################ 37: 38: sub BUILD { 39: my $self = shift; 40: 41: $self->api_resource_name('channel'); 42: $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: return 1; 56: } 57: 58: ################################################################################ 59: 60: sub _build_extra_updated_at { 61: my $self = shift; 62: 63: return $self->_from_epoch($self->raw_data->{extra_updated_at}); 64: } 65: 66: sub _build_display_name { 67: my $self = shift; 68: 69: return $self->raw_data->{display_name}; 70: } 71: 72: sub _build_header { 73: my $self = shift; 74: 75: return $self->raw_data->{header}; 76: } 77: 78: sub _build_purpose { 79: my $self = shift; 80: 81: return $self->raw_data->{purpose}; 82: } 83: 84: sub _build_type { 85: my $self = shift; 86: 87: return $self->raw_data->{type} eq 'O' ? 'Public' : 'Private'; 88: } 89: 90: sub _build_total_message_count { 91: my $self = shift; 92: 93: return $self->raw_data->{total_message_count}; 94: } 95: 96: ################################################################################ 97: 98: 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 237: |