| 1 | package WebService::Mattermost::V4::API::Resource::Config; | ||
| 2 | |||
| 3 | # ABSTRACT: Wrapped API methods for the config API endpoints. | ||
| 4 | |||
| 5 | use Moo; | ||
| 6 | use Types::Standard 'Str'; | ||
| 7 | |||
| 8 | extends 'WebService::Mattermost::V4::API::Resource'; | ||
| 9 | |||
| 10 | ################################################################################ | ||
| 11 | |||
| 12 | has view_name => (is => 'ro', isa => Str, default => 'Config'); | ||
| 13 | |||
| 14 | ################################################################################ | ||
| 15 | |||
| 16 | sub get { | ||
| 17 | my $self = shift; | ||
| 18 | |||
| 19 | return $self->_single_view_get(); | ||
| 20 | } | ||
| 21 | |||
| 22 | sub update { | ||
| 23 | my $self = shift; | ||
| 24 | my $args = shift; | ||
| 25 | |||
| 26 | return $self->_single_view_put({ parameters => $args }); | ||
| 27 | } | ||
| 28 | |||
| 29 | sub reload { | ||
| 30 | my $self = shift; | ||
| 31 | |||
| 32 | return $self->_single_view_post({ | ||
| 33 | endpoint => 'reload', | ||
| 34 | view => 'Status', | ||
| 35 | }); | ||
| 36 | } | ||
| 37 | |||
| 38 | sub client_subset { | ||
| 39 | my $self = shift; | ||
| 40 | my $args = shift; | ||
| 41 | |||
| 42 | return $self->_get({ | ||
| 43 | endpoint => 'client', | ||
| 44 | parameters => $args, | ||
| 45 | required => [ 'format' ], | ||
| 46 | }); | ||
| 47 | } | ||
| 48 | |||
| 49 | sub set_by_environment { | ||
| 50 | my $self = shift; | ||
| 51 | |||
| 52 | return $self->_single_view_get({ endpoint => 'environment' }); | ||
| 53 | } | ||
| 54 | |||
| 55 | ################################################################################ | ||
| 56 | |||
| 57 | 1; | ||
| 58 | |||
| 59 | __END__ | ||
| 60 | |||
| 61 | =pod | ||
| 62 | |||
| 63 | =encoding UTF-8 | ||
| 64 | |||
| 65 | =head1 NAME | ||
| 66 | |||
| 67 | WebService::Mattermost::V4::API::Resource::Config - Wrapped API methods for the config API endpoints. | ||
| 68 | |||
| 69 | =head1 VERSION | ||
| 70 | |||
| 71 | version 0.28 | ||
| 72 | |||
| 73 | =head1 DESCRIPTION | ||
| 74 | |||
| 75 | =head2 USAGE | ||
| 76 | |||
| 77 | use WebService::Mattermost; | ||
| 78 | |||
| 79 | my $mm = WebService::Mattermost->new({ | ||
| 80 | authenticate => 1, | ||
| 81 | username => 'me@somewhere.com', | ||
| 82 | password => 'hunter2', | ||
| 83 | base_url => 'https://my.mattermost.server.com/api/v4/', | ||
| 84 | }); | ||
| 85 | |||
| 86 | my $resource = $mm->api->config; | ||
| 87 | |||
| 88 | =head2 METHODS | ||
| 89 | |||
| 90 | =over 4 | ||
| 91 | |||
| 92 | =item C<get()> | ||
| 93 | |||
| 94 | L<Get configuration|https://api.mattermost.com/#tag/system%2Fpaths%2F~1file~1s3_test%2Fpost> | ||
| 95 | |||
| 96 | my $response = $resource->get(); | ||
| 97 | |||
| 98 | =item C<update()> | ||
| 99 | |||
| 100 | L<Update configuration|https://api.mattermost.com/#tag/system%2Fpaths%2F~1config%2Fput> | ||
| 101 | |||
| 102 | There are many available parameters for this API call which may require reading | ||
| 103 | of the API documentation. | ||
| 104 | |||
| 105 | my $response = $resource->update({ | ||
| 106 | # Optional parameters: | ||
| 107 | ServiceSettings => {}, | ||
| 108 | TeamSettings => {}, | ||
| 109 | SqlSettings => {}, | ||
| 110 | LogSettings => {}, | ||
| 111 | PasswordSettings => {}, | ||
| 112 | FileSettings => {}, | ||
| 113 | EmailSettings => {}, | ||
| 114 | RateLimitSettings => {}, | ||
| 115 | PrivacySettings => {}, | ||
| 116 | SupportSettings => {}, | ||
| 117 | GitLabSettings => {}, | ||
| 118 | GoogleSettings => {}, | ||
| 119 | Office365Settings => {}, | ||
| 120 | LdapSettings => {}, | ||
| 121 | ComplianceSettings => {}, | ||
| 122 | LocalizationSettings => {}, | ||
| 123 | SamlSettings => {}, | ||
| 124 | NativeAppSettings => {}, | ||
| 125 | ClusterSettings => {}, | ||
| 126 | MetricsSettings => {}, | ||
| 127 | AnalyticsSettings => {}, | ||
| 128 | WebrtcSettings => {}, | ||
| 129 | }); | ||
| 130 | |||
| 131 | =item C<reload()> | ||
| 132 | |||
| 133 | L<Reload configuration|https://api.mattermost.com/#tag/system%2Fpaths%2F~1config~1reload%2Fpost> | ||
| 134 | |||
| 135 | my $response = $resource->reload(); | ||
| 136 | |||
| 137 | =item C<client_subset()> | ||
| 138 | |||
| 139 | L<Get client configuration|https://api.mattermost.com/#tag/system%2Fpaths%2F~1config~1reload%2Fpost> | ||
| 140 | |||
| 141 | my $response = $resource->client_subset(); | ||
| 142 | |||
| 143 | =item C<set_by_environment()> | ||
| 144 | |||
| 145 | L<Get configuration made through environment variables|https://api.mattermost.com/#tag/system%2Fpaths%2F~1config~1environment%2Fget> | ||
| 146 | |||
| 147 | my $response = $client->set_by_environment(); | ||
| 148 | |||
| 149 | =back | ||
| 150 | |||
| 151 | =head1 AUTHOR | ||
| 152 | |||
| 153 | Mike Jones <mike@netsplit.org.uk> | ||
| 154 | |||
| 155 | =head1 COPYRIGHT AND LICENSE | ||
| 156 | |||
| 157 | This software is Copyright (c) 2020 by Mike Jones. | ||
| 158 | |||
| 159 | This is free software, licensed under: | ||
| 160 | |||
| 161 | The MIT (X11) License | ||
| 162 | |||
| 163 | =cut |