| 1 | package WebService::Mattermost::V4::API::Object::File; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: A file item. | ||||||||||
| 4 | |||||||||||
| 5 | 12 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 12 | ▶ | use Types::Standard qw(Bool 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::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 | 12 | has [ qw(extension mime_type) ] => (is => 'ro', isa => Maybe[Str], lazy => 1, builder => 1); | |||||||||
| 21 | 12 | has [ qw(size width height) ] => (is => 'ro', isa => Maybe[Int], lazy => 1, builder => 1); | |||||||||
| 22 | 12 | has has_preview_image => (is => 'ro', isa => Maybe[Bool], lazy => 1, builder => 1); | |||||||||
| 23 | |||||||||||
| 24 | ################################################################################ | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub _build_extension { shift->raw_data->{extension} } | ||||||||
|
Subroutine
_build_extension: not called CC=1 SCAR=6.9
| |||||||||||
| 27 | 0 | ▶ | sub _build_mime_type { shift->raw_data->{mime_type} } | ||||||||
|
Subroutine
_build_mime_type: not called CC=1 SCAR=6.9
| |||||||||||
| 28 | 0 | ▶ | sub _build_size { shift->raw_data->{size} } | ||||||||
|
Subroutine
_build_size: not called CC=1 SCAR=6.9
| |||||||||||
| 29 | 0 | ▶ | sub _build_width { shift->raw_data->{width} } | ||||||||
|
Subroutine
_build_width: not called CC=1 SCAR=6.9
| |||||||||||
| 30 | 0 | ▶ | sub _build_height { shift->raw_data->{height} } | ||||||||
|
Subroutine
_build_height: not called CC=1 SCAR=6.9
| |||||||||||
| 31 | 0 | ▶ | sub _build_has_preview_image { shift->raw_data->{has_preview_image} ? 1 : 0 } | ||||||||
|
Subroutine
_build_has_preview_image: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 32 | |||||||||||
| 33 | ################################################################################ | ||||||||||
| 34 | |||||||||||
| 35 | sub BUILD { | ||||||||||
| 36 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 37 | |||||||||||
| 38 | 0 | $self->api_resource_name('file'); | |||||||||
| 39 | 0 | $self->set_available_api_methods([ qw( | |||||||||
| 40 | get_thumbnail | ||||||||||
| 41 | get_preview | ||||||||||
| 42 | get_link | ||||||||||
| 43 | get_metadata | ||||||||||
| 44 | ) ]); | ||||||||||
| 45 | |||||||||||
| 46 | 0 | return 1; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | ################################################################################ | ||||||||||
| 50 | |||||||||||
| 51 | 12 | 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 | ||||||||||