blib/lib/WebService/Mattermost/V4/API/Object/File.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 6 | 16 | 37.5 |
branch | 0 | 2 | 0.0 |
condition | n/a | ||
subroutine | 2 | 9 | 22.2 |
pod | 0 | 1 | 0.0 |
total | 8 | 28 | 28.5 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package WebService::Mattermost::V4::API::Object::File; 2: 3: # ABSTRACT: A file item. 4: 5: use Moo; 6: use Types::Standard qw(Bool 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::BelongingToPost 12: WebService::Mattermost::V4::API::Object::Role::BelongingToUser 13: WebService::Mattermost::V4::API::Object::Role::ID 14: WebService::Mattermost::V4::API::Object::Role::Name 15: WebService::Mattermost::V4::API::Object::Role::Timestamps 16: ); 17: 18: ################################################################################ 19: 20: has [ qw(extension mime_type) ] => (is => 'ro', isa => Maybe[Str], lazy => 1, builder => 1); 21: has [ qw(size width height) ] => (is => 'ro', isa => Maybe[Int], lazy => 1, builder => 1); 22: has has_preview_image => (is => 'ro', isa => Maybe[Bool], lazy => 1, builder => 1); 23: 24: ################################################################################ 25: 26: sub _build_extension { shift->raw_data->{extension} } 27: sub _build_mime_type { shift->raw_data->{mime_type} } 28: sub _build_size { shift->raw_data->{size} } 29: sub _build_width { shift->raw_data->{width} } 30: sub _build_height { shift->raw_data->{height} } 31: sub _build_has_preview_image { shift->raw_data->{has_preview_image} ? 1 : 0 } 32: 33: ################################################################################ 34: 35: sub BUILD { 36: my $self = shift; 37: 38: $self->api_resource_name('file'); 39: $self->set_available_api_methods([ qw( 40: get_thumbnail 41: get_preview 42: get_link 43: get_metadata 44: ) ]); 45: 46: return 1; 47: } 48: 49: ################################################################################ 50: 51: 1; 52: 53: __END__ 54: 55: =pod 56: 57: =encoding UTF-8 58: 59: =head1 NAME 60: 61: WebService::Mattermost::V4::API::Object::File - A file item. 62: 63: =head1 VERSION 64: 65: version 0.28 66: 67: =head1 DESCRIPTION 68: 69: Details a Mattermost File object. 70: 71: =head2 METHODS 72: 73: See matching methods in L<WebService::Mattermost::V4::API::Resource::File> 74: for full documentation. 75: 76: ID parameters are not required: 77: 78: my $response = $mattermost->api->file->get('ID-HERE')->item->get_thumbnail(); 79: 80: Is the same as: 81: 82: my $response = $mattermost->api->file->get_thumbnail('ID-HERE'); 83: 84: =over 4 85: 86: =item C<get_thumbnail()> 87: 88: =item C<get_preview()> 89: 90: =item C<get_link()> 91: 92: =item C<get_metadata()> 93: 94: =back 95: 96: =head2 ATTRIBUTES 97: 98: =over 4 99: 100: =item C<extension> 101: 102: =item C<has_preview_image> 103: 104: =item C<height> 105: 106: =item C<mime_type> 107: 108: =item C<size> 109: 110: =item C<width> 111: 112: =back 113: 114: =head1 SEE ALSO 115: 116: =over 4 117: 118: =item L<WebService::Mattermost::V4::API::Resource::File> 119: 120: =item L<WebService::Mattermost::V4::API::Resource::Files> 121: 122: =item L<WebService::Mattermost::V4::API::Object::Role::BelongingToPost> 123: 124: =item L<WebService::Mattermost::V4::API::Object::Role::BelongingToUser> 125: 126: =item L<WebService::Mattermost::V4::API::Object::Role::ID> 127: 128: =item L<WebService::Mattermost::V4::API::Object::Role::Name> 129: 130: =item L<WebService::Mattermost::V4::API::Object::Role::Timestamps> 131: 132: =back 133: 134: =head1 AUTHOR 135: 136: Mike Jones <mike@netsplit.org.uk> 137: 138: =head1 COPYRIGHT AND LICENSE 139: 140: This software is Copyright (c) 2020 by Mike Jones. 141: 142: This is free software, licensed under: 143: 144: The MIT (X11) License 145: 146: =cut 147: |