PluginProbe
Metricool – Social media and site statistics / 2.0.2
Metricool – Social media and site statistics v2.0.2
2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.27 trunk
metricool / app / Http / Metricool / Entities / UserCredentials.php

UserCredentials.php in Metricool – Social media and site statistics 2.0.2, at app/Http/Metricool/Entities/UserCredentials.php

36 lines 853 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Metricool\Http\Metricool\Entities;
6
7 use Metricool\Http\Metricool\Exceptions\ApiException;
8 use Metricool\Http\Metricool\MetricoolClient;
9
10 class UserCredentials
11 {
12 protected MetricoolClient $client;
13 protected string $endpoint;
14
15 public function __construct(MetricoolClient $client)
16 {
17 $this->client = $client;
18 $this->endpoint = 'v2/settings/users/' . $client->getUserId() . '/credentials';
19 }
20
21 /**
22 * Update the user password
23 *
24 * @throws ApiException
25 */
26 public function updatePassword(string $oldPassword, string $newPassword): array
27 {
28 $this->client->patch($this->endpoint . '?fields=password', [
29 'oldPassword' => $oldPassword,
30 'password' => $newPassword,
31 ]);
32
33 return ['success' => true];
34 }
35 }
36