| 1 | package WebService::Mattermost::V4::API::Object::User; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: A user item. | ||||||||||
| 4 | |||||||||||
| 5 | 12 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 12 | ▶ | use Types::Standard qw(ArrayRef Bool 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::ID | ||||||||||
| 11 | WebService::Mattermost::V4::API::Object::Role::Roles | ||||||||||
| 12 | WebService::Mattermost::V4::API::Object::Role::Timestamps | ||||||||||
| 13 | WebService::Mattermost::V4::API::Object::Role::APIMethods | ||||||||||
| 14 | ); | ||||||||||
| 15 | |||||||||||
| 16 | ################################################################################ | ||||||||||
| 17 | |||||||||||
| 18 | 12 | has [ qw( | |||||||||
| 19 | allow_marketing | ||||||||||
| 20 | is_system_admin | ||||||||||
| 21 | is_system_user | ||||||||||
| 22 | ) ] => (is => 'ro', isa => Bool, lazy => 1, builder => 1); | ||||||||||
| 23 | |||||||||||
| 24 | 12 | has [ qw( | |||||||||
| 25 | auth_data | ||||||||||
| 26 | auth_service | ||||||||||
| 27 | |||||||||||
| 28 | first_name | ||||||||||
| 29 | last_name | ||||||||||
| 30 | locale | ||||||||||
| 31 | nickname | ||||||||||
| 32 | position | ||||||||||
| 33 | username | ||||||||||
| 34 | ) ] => (is => 'ro', isa => Maybe[Str], lazy => 1, builder => 1); | ||||||||||
| 35 | |||||||||||
| 36 | 12 | has [ qw( | |||||||||
| 37 | password_updated_at | ||||||||||
| 38 | picture_updated_at | ||||||||||
| 39 | ) ] => (is => 'ro', isa => Maybe[InstanceOf['DateTime']], lazy => 1, builder => 1); | ||||||||||
| 40 | |||||||||||
| 41 | ################################################################################ | ||||||||||
| 42 | |||||||||||
| 43 | sub BUILD { | ||||||||||
| 44 | 1 | ▶ | my $self = shift; | ||||||||
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 45 | |||||||||||
| 46 | 1 | $self->api_resource_name('user'); | |||||||||
| 47 | 1 | $self->set_available_api_methods([ qw( | |||||||||
| 48 | generate_mfa_secret | ||||||||||
| 49 | get_profile_image | ||||||||||
| 50 | get_status | ||||||||||
| 51 | patch | ||||||||||
| 52 | set_profile_image | ||||||||||
| 53 | set_status | ||||||||||
| 54 | teams | ||||||||||
| 55 | update | ||||||||||
| 56 | update_active_status | ||||||||||
| 57 | update_authentication_method | ||||||||||
| 58 | update_mfa | ||||||||||
| 59 | update_password | ||||||||||
| 60 | update_roles | ||||||||||
| 61 | ) ]); | ||||||||||
| 62 | |||||||||||
| 63 | 1 | return 1; | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | ################################################################################ | ||||||||||
| 67 | |||||||||||
| 68 | sub _build_allow_marketing { | ||||||||||
| 69 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_allow_marketing: not called CC=2 SCAR=17.9
| |||||||||||
| 70 | |||||||||||
| 71 | 0 | ▶ | return $self->raw_data->{allow_marketing} ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | sub _build_is_system_admin { | ||||||||||
| 75 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_is_system_admin: not called CC=2 SCAR=17.9
| |||||||||||
| 76 | |||||||||||
| 77 | 0 | ▶ | return $self->roles =~ /system_admin/ ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | sub _build_is_system_user { | ||||||||||
| 81 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_is_system_user: not called CC=2 SCAR=17.9
| |||||||||||
| 82 | |||||||||||
| 83 | 0 | ▶ | return $self->roles =~ /system_user/ ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | sub _build_password_updated_at { | ||||||||||
| 87 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_password_updated_at: not called CC=1 SCAR=6.9
| |||||||||||
| 88 | |||||||||||
| 89 | 0 | return $self->_from_epoch($self->raw_data->{last_password_update}); | |||||||||
| 90 | } | ||||||||||
| 91 | |||||||||||
| 92 | sub _build_picture_updated_at { | ||||||||||
| 93 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_picture_updated_at: not called CC=1 SCAR=6.9
| |||||||||||
| 94 | |||||||||||
| 95 | 0 | return $self->_from_epoch($self->raw_data->{last_picture_update}); | |||||||||
| 96 | } | ||||||||||
| 97 | |||||||||||
| 98 | ################################################################################ | ||||||||||
| 99 | |||||||||||
| 100 | 12 | 1; | |||||||||
| 101 | |||||||||||
| 102 | __END__ | ||||||||||
| 103 | |||||||||||
| 104 | =pod | ||||||||||
| 105 | |||||||||||
| 106 | =encoding UTF-8 | ||||||||||
| 107 | |||||||||||
| 108 | =head1 NAME | ||||||||||
| 109 | |||||||||||
| 110 | WebService::Mattermost::V4::API::Object::User - A user item. | ||||||||||
| 111 | |||||||||||
| 112 | =head1 VERSION | ||||||||||
| 113 | |||||||||||
| 114 | version 0.28 | ||||||||||
| 115 | |||||||||||
| 116 | =head1 DESCRIPTION | ||||||||||
| 117 | |||||||||||
| 118 | Object version of a Mattermost user. | ||||||||||
| 119 | |||||||||||
| 120 | =head2 METHODS | ||||||||||
| 121 | |||||||||||
| 122 | See matching methods in L<WebService::Mattermost::V4::API::Resource::User> for | ||||||||||
| 123 | full documentation. | ||||||||||
| 124 | |||||||||||
| 125 | ID parameters are not required: | ||||||||||
| 126 | |||||||||||
| 127 | my $response = $mattermost->api->user->get('ID-HERE')->item->get_status(); | ||||||||||
| 128 | |||||||||||
| 129 | Is the same as: | ||||||||||
| 130 | |||||||||||
| 131 | my $response = $mattermost->api->user->get_status('ID-HERE'); | ||||||||||
| 132 | |||||||||||
| 133 | =over 4 | ||||||||||
| 134 | |||||||||||
| 135 | =item C<generate_mfa_secret()> | ||||||||||
| 136 | |||||||||||
| 137 | =item C<get_profile_image()> | ||||||||||
| 138 | |||||||||||
| 139 | =item C<get_status()> | ||||||||||
| 140 | |||||||||||
| 141 | =item C<patch()> | ||||||||||
| 142 | |||||||||||
| 143 | =item C<set_profile_image()> | ||||||||||
| 144 | |||||||||||
| 145 | =item C<set_status()> | ||||||||||
| 146 | |||||||||||
| 147 | =item C<teams()> | ||||||||||
| 148 | |||||||||||
| 149 | =item C<update()> | ||||||||||
| 150 | |||||||||||
| 151 | =item C<update_active_status()> | ||||||||||
| 152 | |||||||||||
| 153 | =item C<update_authentication_method()> | ||||||||||
| 154 | |||||||||||
| 155 | =item C<update_mfa()> | ||||||||||
| 156 | |||||||||||
| 157 | =item C<update_password()> | ||||||||||
| 158 | |||||||||||
| 159 | =item C<update_roles()> | ||||||||||
| 160 | |||||||||||
| 161 | =back | ||||||||||
| 162 | |||||||||||
| 163 | =head1 SEE ALSO | ||||||||||
| 164 | |||||||||||
| 165 | =over 4 | ||||||||||
| 166 | |||||||||||
| 167 | =item L<WebService::Mattermost::V4::API::Resource::User> | ||||||||||
| 168 | |||||||||||
| 169 | =item L<WebService::Mattermost::V4::API::Object::Role::ID> | ||||||||||
| 170 | |||||||||||
| 171 | =item L<WebService::Mattermost::V4::API::Object::Role::Roles> | ||||||||||
| 172 | |||||||||||
| 173 | =item L<WebService::Mattermost::V4::API::Object::Role::Timestamps> | ||||||||||
| 174 | |||||||||||
| 175 | =back | ||||||||||
| 176 | |||||||||||
| 177 | =head1 AUTHOR | ||||||||||
| 178 | |||||||||||
| 179 | Mike Jones <mike@netsplit.org.uk> | ||||||||||
| 180 | |||||||||||
| 181 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 182 | |||||||||||
| 183 | This software is Copyright (c) 2020 by Mike Jones. | ||||||||||
| 184 | |||||||||||
| 185 | This is free software, licensed under: | ||||||||||
| 186 | |||||||||||
| 187 | The MIT (X11) License | ||||||||||
| 188 | |||||||||||
| 189 | =cut | ||||||||||